Skip to content

Commit

Permalink
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -125,8 +125,8 @@ public Backtrace getBacktrace(Node currentNode,
final ArrayList<Activation> activations = new ArrayList<>();

if (omit == 0 && currentNode != null && Truffle.getRuntime().getCurrentFrame() != null) {
final InternalMethod method = RubyArguments.getMethod(Truffle.getRuntime().getCurrentFrame()
.getFrame(FrameInstance.FrameAccess.READ_ONLY, true));
final InternalMethod method = RubyArguments.tryGetMethod(Truffle.getRuntime().getCurrentFrame()
.getFrame(FrameInstance.FrameAccess.READ_ONLY, true).getArguments());

activations.add(new Activation(currentNode, method));
}
Original file line number Diff line number Diff line change
@@ -215,6 +215,20 @@ public static DynamicObject tryGetBlock(Object[] arguments) {
}
}

public static InternalMethod tryGetMethod(Object[] arguments) {
if (ArgumentIndicies.METHOD.ordinal() >= arguments.length) {
return null;
}

final Object method = arguments[ArgumentIndicies.METHOD.ordinal()];

if (method instanceof InternalMethod) {
return (InternalMethod) method;
}

return null;
}

// Setters

public static void setDeclarationFrame(Object[] arguments, MaterializedFrame declarationFrame) {

0 comments on commit c8543ea

Please sign in to comment.