Skip to content

Commit f67c619

Browse files
committed
Allow delegation of '**' through to method calls
1 parent 8f68c82 commit f67c619

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,9 +1885,15 @@ private Operand buildRestKeywordArgs(KeywordHashNode keywordArgs, int[] flags) {
18851885
boolean containsVariableAssignment = containsVariableAssignment(keywordArgs);
18861886

18871887
if (pairs.length == 1) { // Only a single rest arg here. Do not bother to merge.
1888-
Operand splat = buildWithOrder(((AssocSplatNode) pairs[0]).value, containsVariableAssignment);
1888+
var pair = (AssocSplatNode) pairs[0];
18891889

1890-
return addResultInstr(new RuntimeHelperCall(temp(), HASH_CHECK, new Operand[] { splat }));
1890+
if (pair.value == null) {
1891+
return scope.lookupExistingLVar(symbol("**"));
1892+
} else {
1893+
Operand splat = buildWithOrder(pair.value, containsVariableAssignment);
1894+
1895+
return addResultInstr(new RuntimeHelperCall(temp(), HASH_CHECK, new Operand[]{splat}));
1896+
}
18911897
}
18921898

18931899
Variable splatValue = copy(new Hash(new ArrayList<>()));

0 commit comments

Comments
 (0)