Skip to content

Commit

Permalink
Compile calls with multiple args correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 6, 2020
1 parent f21a031 commit 5e813ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Raku/Actions.nqp
Expand Up @@ -240,8 +240,15 @@ class Raku::Actions is HLL::Actions {

method arglist($/) {
if $<EXPR> {
# TODO multiple args
make self.r('ArgList').new($<EXPR>.ast);
my $expr := $<EXPR>.ast;
if nqp::istype($expr, self.r('ApplyListInfix')) &&
nqp::istype($expr.infix, self.r('Infix')) &&
$expr.infix.operator eq ',' {
make self.r('ArgList').from-comma-list($expr);
}
else {
make self.r('ArgList').new($expr);
}
}
else {
make self.r('ArgList').new();
Expand Down
7 changes: 7 additions & 0 deletions src/Raku/ast/call.rakumod
Expand Up @@ -8,6 +8,13 @@ class RakuAST::ArgList is RakuAST::Node {
$obj
}

method from-comma-list(RakuAST::ApplyListInfix $comma-apply) {
my $obj := nqp::create(self);
nqp::bindattr($obj, RakuAST::ArgList, '$!args',
self.IMPL-UNWRAP-LIST($comma-apply.operands));
$obj
}

method args() {
self.IMPL-WRAP-LIST($!args)
}
Expand Down

0 comments on commit 5e813ac

Please sign in to comment.