Skip to content

Commit 2d95cfe

Browse files
committed
Use ReadCallerFrameNode in ModuleNodes#instance_method to support refinements
1 parent f8b9429 commit 2d95cfe

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/org/truffleruby/core/module/ModuleNodes.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,16 +1836,17 @@ protected RubyArray instanceMethods(RubyModule module, boolean includeAncestors)
18361836
@NodeChild(value = "module", type = RubyNode.class)
18371837
@NodeChild(value = "name", type = RubyNode.class)
18381838
public abstract static class InstanceMethodNode extends CoreMethodNode {
1839+
@Child private ReadCallerFrameNode readCallerFrame = ReadCallerFrameNode.create();
18391840

18401841
@CreateCast("name")
18411842
protected RubyNode coerceToString(RubyNode name) {
18421843
return NameToJavaStringNode.create(name);
18431844
}
18441845

18451846
@Specialization
1846-
protected RubyUnboundMethod instanceMethod(RubyModule module, String name,
1847+
protected RubyUnboundMethod instanceMethod(VirtualFrame frame, RubyModule module, String name,
18471848
@Cached BranchProfile errorProfile) {
1848-
final Frame callerFrame = getContext().getCallStack().getCallerFrameIgnoringSend(FrameAccess.READ_ONLY);
1849+
final Frame callerFrame = readCallerFrame.execute(frame);
18491850
final DeclarationContext declarationContext = RubyArguments.getDeclarationContext(callerFrame);
18501851

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

src/main/java/org/truffleruby/language/methods/GetMethodObjectNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ protected abstract RubyMethod execute(Frame frame, Object self, Object name,
5656
DispatchConfiguration dispatchConfig, MaterializedFrame callerFrame);
5757

5858
@Specialization
59-
protected RubyMethod getMethodObject(Frame frame, Object self, Object name,
59+
protected RubyMethod getMethodObject(
60+
Frame frame,
61+
Object self,
62+
Object name,
6063
DispatchConfiguration dispatchConfig,
6164
MaterializedFrame callerFrame,
6265
@CachedContext(RubyLanguage.class) RubyContext context,

0 commit comments

Comments
 (0)