Skip to content

Commit

Permalink
Use ReadCallerFrameNode in ModuleNodes#instance_method to support ref…
Browse files Browse the repository at this point in the history
…inements
  • Loading branch information
ssnickolay committed Jan 29, 2021
1 parent f8b9429 commit 01ef61a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/truffleruby/core/module/ModuleNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -1836,16 +1836,17 @@ protected RubyArray instanceMethods(RubyModule module, boolean includeAncestors)
@NodeChild(value = "module", type = RubyNode.class)
@NodeChild(value = "name", type = RubyNode.class)
public abstract static class InstanceMethodNode extends CoreMethodNode {
@Child private ReadCallerFrameNode readCallerFrame = ReadCallerFrameNode.create();

@CreateCast("name")
protected RubyNode coerceToString(RubyNode name) {
return NameToJavaStringNode.create(name);
}

@Specialization
protected RubyUnboundMethod instanceMethod(RubyModule module, String name,
protected RubyUnboundMethod instanceMethod(VirtualFrame frame, RubyModule module, String name,
@Cached BranchProfile errorProfile) {
final Frame callerFrame = getContext().getCallStack().getCallerFrameIgnoringSend(FrameAccess.READ_ONLY);
final Frame callerFrame = readCallerFrame.execute(frame);
final DeclarationContext declarationContext = RubyArguments.getDeclarationContext(callerFrame);

// TODO(CS, 11-Jan-15) cache this lookup
Expand Down

0 comments on commit 01ef61a

Please sign in to comment.