Skip to content

Commit c9464cf

Browse files
committed
Fix last forwarding issues via eval in spec/ruby
1 parent 9ea9234 commit c9464cf

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,7 @@ protected Operand[] buildCallArgsArray(Node[] children, int[] flags) {
704704
flags[0] |= CALL_SPLATS;
705705
builtArgs[i] = new Splat(addResultInstr(new BuildSplatInstr(temp(), build(splat), true)));
706706
} else {
707-
// Note: WOOF. Prism forwarding returns '*' as an expressless splat instead of a splat
708-
// of a lvar named '*'. IRScope cannot give us the power to search assuming this is all
709-
// going to be handed to it by the parser so we need to look it up in StaticScope.
710-
var slot = scope.getStaticScope().isDefined("*");
711-
var lvar = new LocalVariable(symbol("*"), slot >> 16, slot & 0xffff, true);
707+
var lvar = getLocalVariable(symbol("*"), scope.getStaticScope().isDefined("*"));
712708
builtArgs[i] = new Splat(lvar);
713709
}
714710
} else if (child instanceof KeywordHashNode hash && i == numberOfArgs - 1) {
@@ -1709,6 +1705,7 @@ private void buildParameters(ParametersNode parameters) {
17091705
if (parameters.keyword_rest instanceof ForwardingParameterNode) {
17101706
Variable keywords = addResultInstr(new ReceiveKeywordsInstr(temp(), true, true));
17111707
receiveNonBlockArgs(parameters, keywords, true);
1708+
argumentResult(symbol(FWD_ALL)); // Dummy placeholder so eval parses know this is a forward all
17121709
RubySymbol restName = symbol(FWD_REST);
17131710
RubySymbol kwrestName = symbol(FWD_KWREST);
17141711
RubySymbol blockName = symbol(FWD_BLOCK);
@@ -1890,11 +1887,7 @@ private Operand buildRestKeywordArgs(KeywordHashNode keywordArgs, int[] flags) {
18901887
var pair = (AssocSplatNode) pairs[0];
18911888

18921889
if (pair.value == null) {
1893-
// Note: WOOF. Prism forwarding returns '**' as an expressless splat instead of a splat
1894-
// of a lvar named '**'. IRScope cannot give us the power to search assuming this is all
1895-
// going to be handed to it by the parser so we need to look it up in StaticScope.
1896-
var slot = scope.getStaticScope().isDefined("**");
1897-
return new LocalVariable(symbol("**"), slot >> 16, slot & 0xffff, true);
1890+
return getLocalVariable(symbol("**"), scope.getStaticScope().isDefined("**"));
18981891
} else {
18991892
Operand splat = buildWithOrder(pair.value, containsVariableAssignment);
19001893

0 commit comments

Comments
 (0)