@@ -86,7 +86,7 @@ public int getPreviousIndex() {
86
86
}
87
87
88
88
private final boolean isProc ;
89
- private final boolean hasMethodBlock ;
89
+ private final boolean isMethod ;
90
90
private final BodyTranslator methodBodyTranslator ;
91
91
private final Deque <ArraySlot > arraySlotStack = new ArrayDeque <>();
92
92
@@ -108,7 +108,7 @@ private enum State {
108
108
public LoadArgumentsTranslator (Node currentNode , ArgsParseNode argsNode , RubyContext context , Source source , ParserContext parserContext , boolean isProc , boolean hasMethodBlock , BodyTranslator methodBodyTranslator ) {
109
109
super (currentNode , context , source , parserContext );
110
110
this .isProc = isProc ;
111
- this .hasMethodBlock = hasMethodBlock ;
111
+ this .isMethod = hasMethodBlock ;
112
112
this .methodBodyTranslator = methodBodyTranslator ;
113
113
this .argsNode = argsNode ;
114
114
this .required = argsNode .getRequiredCount ();
@@ -159,8 +159,8 @@ public RubyNode translate() {
159
159
160
160
// Do this before handling optional arguments as one might get
161
161
// its default value via a `yield`.
162
- if (hasMethodBlock ) {
163
- sequence .add (visitMethodBlockArg ());
162
+ if (isMethod ) {
163
+ sequence .add (saveMethodBlockArg ());
164
164
}
165
165
166
166
final int optArgCount = argsNode .getOptionalArgsCount ();
@@ -342,7 +342,7 @@ public RubyNode visitRestArgNode(RestArgParseNode node) {
342
342
return new WriteLocalVariableNode (slot , readNode );
343
343
}
344
344
345
- public RubyNode visitMethodBlockArg () {
345
+ public RubyNode saveMethodBlockArg () {
346
346
final RubyNode readNode = new ReadBlockNode (context .getCoreLibrary ().getNil ());
347
347
final FrameSlot slot = methodBodyTranslator .getEnvironment ().getFrameDescriptor ().findOrAddFrameSlot (TranslatorEnvironment .METHOD_BLOCK_NAME );
348
348
return new WriteLocalVariableNode (slot , readNode );
0 commit comments