Skip to content

Commit 53e8ac3

Browse files
committed
Move implementation details of block args into InlinedBlockGivenNode.
1 parent 732ec90 commit 53e8ac3

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/main/java/org/truffleruby/core/inlined/CoreMethods.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ public RubyNode createCallNode(RubyCallNodeParameters callParameters, Translator
173173
break;
174174
case "block_given?":
175175
if (callParameters.isIgnoreVisibility()) {
176-
RubyNode readBlockNode = environment.findLocalVarOrNilNode(TranslatorEnvironment.IMPLICIT_BLOCK_NAME, null);
177-
return InlinedBlockGivenNodeGen.create(context, callParameters,
178-
readBlockNode,
179-
self);
176+
return InlinedBlockGivenNodeGen.create(context, callParameters, environment, self);
180177
}
181178
break;
182179
case "nil?":

src/main/java/org/truffleruby/core/inlined/InlinedBlockGivenNode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.truffleruby.language.RubyNode;
1414
import org.truffleruby.language.dispatch.RubyCallNodeParameters;
1515
import org.truffleruby.language.methods.LookupMethodNode;
16+
import org.truffleruby.parser.TranslatorEnvironment;
1617

1718
import com.oracle.truffle.api.dsl.Cached;
1819
import com.oracle.truffle.api.dsl.Fallback;
@@ -24,9 +25,9 @@ public abstract class InlinedBlockGivenNode extends UnaryInlinedOperationNode {
2425
protected static final String METHOD = "block_given?";
2526
@Child protected RubyNode readNode;
2627

27-
public InlinedBlockGivenNode(RubyContext context, RubyCallNodeParameters callNodeParameters, RubyNode readNode) {
28+
public InlinedBlockGivenNode(RubyContext context, RubyCallNodeParameters callNodeParameters, TranslatorEnvironment environment) {
2829
super(callNodeParameters);
29-
this.readNode = readNode;
30+
this.readNode = environment.findLocalVarOrNilNode(TranslatorEnvironment.IMPLICIT_BLOCK_NAME, null);
3031
}
3132

3233
@Specialization(guards = {

0 commit comments

Comments
 (0)