diff --git a/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java b/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java index eb903e2975d..9f7f1782314 100644 --- a/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java +++ b/core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java @@ -2655,8 +2655,11 @@ public Operand buildVCall(Variable result, VCallNode node) { switch (callName) { case "__method__": case "__callee__": - addInstr(new FrameNameCallInstr(result, callName)); - return result; + // narrow to methods until we can fix other scopes' frame names + if (scope instanceof IRMethod) { + addInstr(new FrameNameCallInstr(result, callName)); + return result; + } } return _call(result, VARIABLE, buildSelf(), node.getName());