Skip to content

Commit

Permalink
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/language/block_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1990,7 +1990,7 @@ private RubyNode translateBlockLikeNode(IterParseNode node, boolean isLambda) {
final RubyNode definitionNode;

try {
definitionNode = methodCompiler.compileBlockNode(sourceSection, sharedMethodInfo.getName(), node.getBodyNode(), sharedMethodInfo, type);
definitionNode = methodCompiler.compileBlockNode(sourceSection, sharedMethodInfo.getName(), node.getBodyNode(), sharedMethodInfo, type, node.getScope().getVariables());
} finally {
if (isLambda) {
frameOnStackMarkerSlotStack.pop();
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public MethodTranslator(Node currentNode, RubyContext context, BodyTranslator pa
this.argsNode = argsNode;
}

public BlockDefinitionNode compileBlockNode(RubySourceSection sourceSection, String methodName, ParseNode bodyNode, SharedMethodInfo sharedMethodInfo, ProcType type) {
public BlockDefinitionNode compileBlockNode(RubySourceSection sourceSection, String methodName, ParseNode bodyNode, SharedMethodInfo sharedMethodInfo, ProcType type, String[] variables) {
final SourceSection fullSourceSection = sourceSection.toSourceSection(source);

declareArguments();
@@ -135,9 +135,10 @@ public BlockDefinitionNode compileBlockNode(RubySourceSection sourceSection, Str

parentSourceSection.push(sourceSection);
try {
if (argsNode.getBlockLocalVariables() != null && !argsNode.getBlockLocalVariables().isEmpty()) {
for (ParseNode var : argsNode.getBlockLocalVariables().children()) {
environment.declareVar(((INameNode) var).getName());
if (!translatingForStatement) {
// Make sure to declare block-local variables
for (String var : variables) {
environment.declareVar(var);
}
}

0 comments on commit 55d74cb

Please sign in to comment.