diff options
-rw-r--r-- | parser.y | 4 | ||||
-rw-r--r-- | tests/00_syntax/20_list_expressions | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -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; } diff --git a/tests/00_syntax/20_list_expressions b/tests/00_syntax/20_list_expressions index ef1b0c4..d5ba459 100644 --- a/tests/00_syntax/20_list_expressions +++ b/tests/00_syntax/20_list_expressions @@ -13,6 +13,7 @@ function call true true true +[ 2, 3 ] -- End -- -- Testcase -- @@ -37,5 +38,8 @@ true // computed property access uses the last list expression value print(({foo: true})["bar", "baz", "foo"], "\n"); + + // same list semantics apply to function call parameters + ((...args) => print(args, "\n"))((1, 2), 3); %} -- End -- |