Skip to content

Commit ddae801

Browse files
committed
Simplify has-own-scope condition in handling for-loop block
1 parent a470d79 commit ddae801

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ private RubyNode translateBlockLikeNode(IterParseNode node, boolean isStabbyLamb
18181818
final ArgsParseNode argsNode = node.getArgsNode();
18191819

18201820
// Unset this flag for any blocks within the `for` statement's body
1821-
final boolean hasOwnScope = isStabbyLambda || !translatingForStatement;
1821+
final boolean hasOwnScope = !translatingForStatement;
18221822

18231823
final boolean isProc = !isStabbyLambda;
18241824

src/main/java/org/truffleruby/parser/YARPTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ private RubyNode translateBlockAndLambda(Nodes.Node node, Nodes.Node parametersN
474474
final boolean isStabbyLambda = node instanceof Nodes.LambdaNode;
475475

476476
// Unset this flag for a `for`-loop's block
477-
final boolean hasOwnScope = isStabbyLambda || !translatingForStatement; // TODO: isStabbyLambda seems excessive
477+
final boolean hasOwnScope = !translatingForStatement;
478478

479479
TranslatorEnvironment methodParent = environment.getSurroundingMethodEnvironment();
480480
final String methodName = methodParent.getMethodName();

0 commit comments

Comments
 (0)