use of org.graalvm.compiler.graph.SourceLanguagePosition in project graal by oracle.
the class BinaryGraphPrinter method methodLocation.
@Override
public Iterable<SourceLanguagePosition> methodLocation(ResolvedJavaMethod method, int bci, NodeSourcePosition pos) {
StackTraceElement e = methodStackTraceElement(method, bci, pos);
class JavaSourcePosition implements SourceLanguagePosition {
@Override
public String toShortString() {
return e.toString();
}
@Override
public int getOffsetEnd() {
return -1;
}
@Override
public int getOffsetStart() {
return -1;
}
@Override
public int getLineNumber() {
return e.getLineNumber();
}
@Override
public URI getURI() {
String path = e.getFileName();
try {
return path == null ? null : new URI(null, null, path, null);
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(ex);
}
}
@Override
public String getLanguage() {
return "Java";
}
}
List<SourceLanguagePosition> arr = new ArrayList<>();
arr.add(new JavaSourcePosition());
NodeSourcePosition at = pos;
while (at != null) {
SourceLanguagePosition cur = at.getSourceLanguage();
if (cur != null) {
arr.add(cur);
}
at = at.getCaller();
}
return arr;
}
Aggregations