diff options
author | Li Jin <dragon-fly@qq.com> | 2023-08-08 18:12:06 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-08-08 18:12:16 +0800 |
commit | 60774555568dbc64866d088cb51e45f9434c0f89 (patch) | |
tree | f38b9eb54e1b647e9d222dcba0e5ff3716016424 /spec/inputs | |
parent | 878111166eb4cfe4ddbc05f60e797ee16356e71a (diff) | |
download | yuescript-60774555568dbc64866d088cb51e45f9434c0f89.tar.gz yuescript-60774555568dbc64866d088cb51e45f9434c0f89.tar.bz2 yuescript-60774555568dbc64866d088cb51e45f9434c0f89.zip |
make vararg assignment work with line decorator.
Diffstat (limited to 'spec/inputs')
-rw-r--r-- | spec/inputs/vararg.yue | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/inputs/vararg.yue b/spec/inputs/vararg.yue index c7b8ebf..466a4a6 100644 --- a/spec/inputs/vararg.yue +++ b/spec/inputs/vararg.yue | |||
@@ -52,5 +52,27 @@ join = (...) -> | |||
52 | f_colon f!\func | 52 | f_colon f!\func |
53 | f_colon f(...)\func | 53 | f_colon f(...)\func |
54 | 54 | ||
55 | _ = -> | ||
56 | list = {1, 2, 3, 4, 5} | ||
57 | fn = (ok) -> | ||
58 | ok, table.unpack list | ||
59 | ok, ... = fn true | ||
60 | print ok, ... | ||
61 | |||
62 | fn_many_args = -> | ||
63 | 10, nil, 20, nil, 30 | ||
64 | |||
65 | ... = fn_many_args! | ||
66 | print select "#", ... | ||
67 | print ... | ||
68 | |||
69 | do | ||
70 | ... = 1, 2 if true | ||
71 | print ... | ||
72 | |||
73 | do | ||
74 | a, ... = 1, 2 unless true | ||
75 | print a, select '#', ... | ||
76 | |||
55 | nil | 77 | nil |
56 | 78 | ||