@@ -704,7 +704,12 @@ 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- builtArgs [i ] = new Splat (scope .lookupExistingLVar (symbol ("*" )));
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 );
712+ builtArgs [i ] = new Splat (lvar );
708713 }
709714 } else if (child instanceof KeywordHashNode hash && i == numberOfArgs - 1 ) {
710715 builtArgs [i ] = buildCallKeywordArguments (hash , flags ); // FIXME: here and possibly AST make isKeywordsHash() method.
@@ -1885,8 +1890,12 @@ private Operand buildRestKeywordArgs(KeywordHashNode keywordArgs, int[] flags) {
18851890 var pair = (AssocSplatNode ) pairs [0 ];
18861891
18871892 if (pair .value == null ) {
1888- return scope .lookupExistingLVar (symbol ("**" ));
1889- } else {
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 );
1898+ } else {
18901899 Operand splat = buildWithOrder (pair .value , containsVariableAssignment );
18911900
18921901 return addResultInstr (new RuntimeHelperCall (temp (), HASH_CHECK , new Operand []{splat }));
0 commit comments