Skip to content

Commit

Permalink
Only do this optimization for method scopes
Browse files Browse the repository at this point in the history
Non-method scopes like classes and modules have issues with the
frame name not properly propagating into the executing body, and
blocks may be used for define_method which introduces similar
complexities in getting the frame name. This patch temporarily
narrows the frame name optimization to method bodies only.
  • Loading branch information
headius committed May 8, 2024
1 parent cf4f0d4 commit 4aea2b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/org/jruby/ir/builder/IRBuilderAST.java
Expand Up @@ -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());
Expand Down

0 comments on commit 4aea2b7

Please sign in to comment.