summaryrefslogtreecommitdiffhomepage
path: root/parser.y
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-11-09 15:53:40 +0100
committerJo-Philipp Wich <jo@mein.io>2020-11-09 15:57:12 +0100
commit41385a0381a89516fd99989aa3a7dd84c6c33d64 (patch)
tree55b3e4721b633de0a495163956fef1b0cce722e1 /parser.y
parentf6869ee3b02a60b202c703f7caef165ee3845e5a (diff)
syntax: properly handle list expressions in function calls
Ensure that a call like `fn((1, 2), 3)` invokes the function with arguments `2, 3` and not `1, 2, 3`. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/parser.y b/parser.y
index fc8cfe6..6c64c2d 100644
--- a/parser.y
+++ b/parser.y
@@ -394,5 +394,5 @@ tuple(A) ::= T_ELLIP(B) assign_exp(C). { A = wrap_op(B, C); }
arg_exps(A) ::= arg_exps(B) T_COMMA arg_exp(C). { A = append_op(B, C); ut_get_op(s, A)->is_list = 1; }
arg_exps(A) ::= arg_exp(B). { A = B; ut_get_op(s, A)->is_list = 1; }
-arg_exp(A) ::= T_ELLIP assign_exp(B). { A = B; ut_get_op(s, A)->is_ellip = 1; }
-arg_exp(A) ::= assign_exp(B). { A = B; }
+arg_exp(A) ::= T_ELLIP assign_exp(B). { A = ut_get_op(s, B)->tree.next ? new_op(T_COMMA, NULL, B) : B; ut_get_op(s, A)->is_ellip = 1; }
+arg_exp(A) ::= assign_exp(B). { A = ut_get_op(s, B)->tree.next ? new_op(T_COMMA, NULL, B) : B; }