File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
src/main/java/org/truffleruby/parser Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,7 @@ public boolean getNeverAssignInParentScope() {
349
349
return !isBlock ();
350
350
}
351
351
352
+ /** A way to check current scope is a module/class. If in a block, isModuleBody is always false. */
352
353
public boolean isModuleBody () {
353
354
return isModuleBody ;
354
355
}
Original file line number Diff line number Diff line change @@ -1531,15 +1531,13 @@ public RubyNode visitForwardingSuperNode(Nodes.ForwardingSuperNode node) {
1531
1531
boolean insideDefineMethod = false ;
1532
1532
var environment = this .environment ;
1533
1533
while (environment .isBlock ()) {
1534
- if (environment .isModuleBody ()) { // TODO: when could we be in a block and in a module body at the same time?
1535
- return assignPositionAndFlags (node , new ZSuperOutsideMethodNode (insideDefineMethod ));
1536
- } else if (Objects .equals (environment .literalBlockPassedToMethod , "define_method" )) {
1534
+ if (Objects .equals (environment .literalBlockPassedToMethod , "define_method" )) {
1537
1535
insideDefineMethod = true ;
1538
1536
}
1539
1537
environment = environment .getParent ();
1540
1538
}
1541
1539
1542
- if (environment .isModuleBody () || environment . isTopLevelScope () ) {
1540
+ if (environment .isModuleBody ()) {
1543
1541
return assignPositionAndFlags (node , new ZSuperOutsideMethodNode (insideDefineMethod ));
1544
1542
}
1545
1543
You can’t perform that action at this time.
0 commit comments