Skip to content

Commit 8f68c82

Browse files
committed
Support * as a value pass in methods
1 parent e3f182d commit 8f68c82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,13 @@ protected Operand[] buildCallArgsArray(Node[] children, int[] flags) {
687687
for (int i = 0; i < numberOfArgs; i++) {
688688
Node child = children[i];
689689

690-
if (child instanceof SplatNode) {
691-
flags[0] |= CALL_SPLATS;
692-
builtArgs[i] = new Splat(addResultInstr(new BuildSplatInstr(temp(), build(((SplatNode) child).expression), true)));
690+
if (child instanceof SplatNode splat) {
691+
if (splat.expression != null) {
692+
flags[0] |= CALL_SPLATS;
693+
builtArgs[i] = new Splat(addResultInstr(new BuildSplatInstr(temp(), build(splat), true)));
694+
} else {
695+
builtArgs[i] = new Splat(scope.lookupExistingLVar(symbol("*")));
696+
}
693697
} else if (child instanceof KeywordHashNode && i == numberOfArgs - 1) {
694698
builtArgs[i] = buildCallKeywordArguments((KeywordHashNode) children[i], flags); // FIXME: here and possibly AST make isKeywordsHash() method.
695699
} else if (child instanceof ForwardingArgumentsNode) {

0 commit comments

Comments
 (0)