Skip to content

Commit 5a83eb0

Browse files
committed
Mark 'it' as an implicit variable
1 parent ea1d517 commit 5a83eb0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/jruby/prism/builder/IRBuilderPrism.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,11 @@ private void markImplcitNums(StaticScope staticScope, int maximum) {
499499
}
500500
}
501501

502+
private void markIt(StaticScope staticScope) {
503+
int slot = staticScope.existsOrImplicit("it");
504+
staticScope.markImplicitVariable(slot & 0xffff);
505+
}
506+
502507
protected Variable receiveBlockArg(Variable v, Operand argsArray, int argIndex, boolean isSplat) {
503508
if (argsArray != null) {
504509
// We are in a nested receive situation -- when we are not at the root of a masgn tree
@@ -559,6 +564,7 @@ public void receiveBlockArgs(Node node) {
559564
} else if (node instanceof ItParametersNode) {
560565
Variable keywords = addResultInstr(new ReceiveKeywordsInstr(temp(), true, true));
561566
Variable v = getLocalVariable(symbol("it"), 0);
567+
markIt(staticScope);
562568
addInstr(new ReceivePreReqdArgInstr(v, keywords, 0));
563569
} else if (node instanceof BlockParametersNode params) {
564570
// FIXME: Missing locals? Not sure how we handle those but I would have thought with a scope?
@@ -2744,12 +2750,10 @@ public StaticScope createStaticScopeFrom(byte[][] tokens, StaticScope.Type type)
27442750

27452751
public static StaticScope createStaticScopeFrom(String fileName, RubySymbol[] symbols, StaticScope.Type type, StaticScope parent) {
27462752
String[] strings = new String[symbols.length];
2747-
// FIXME: this should be iso_8859_1 strings and not default charset.
27482753
for(int i = 0; i < symbols.length; i++) {
27492754
strings[i] = symbols[i].idString();
27502755
}
27512756

2752-
// FIXME: keywordArgIndex?
27532757
return StaticScopeFactory.newStaticScope(parent, type, fileName, strings, -1);
27542758
}
27552759

0 commit comments

Comments
 (0)