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/outputs | |
| 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/outputs')
| -rw-r--r-- | spec/outputs/vararg.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/outputs/vararg.lua b/spec/outputs/vararg.lua index 56e2011..6cfaccb 100644 --- a/spec/outputs/vararg.lua +++ b/spec/outputs/vararg.lua | |||
| @@ -220,5 +220,50 @@ join = function(...) | |||
| 220 | return _fn_0(_base_0, ...) | 220 | return _fn_0(_base_0, ...) |
| 221 | end | 221 | end |
| 222 | end)(...)) | 222 | end)(...)) |
| 223 | local _ | ||
| 224 | _ = function() | ||
| 225 | local list = { | ||
| 226 | 1, | ||
| 227 | 2, | ||
| 228 | 3, | ||
| 229 | 4, | ||
| 230 | 5 | ||
| 231 | } | ||
| 232 | local fn | ||
| 233 | fn = function(ok) | ||
| 234 | return ok, table.unpack(list) | ||
| 235 | end | ||
| 236 | return (function(_arg_0, ...) | ||
| 237 | local ok = _arg_0 | ||
| 238 | print(ok, ...) | ||
| 239 | local fn_many_args | ||
| 240 | fn_many_args = function() | ||
| 241 | return 10, nil, 20, nil, 30 | ||
| 242 | end | ||
| 243 | return (function(...) | ||
| 244 | print(select("#", ...)) | ||
| 245 | return print(...) | ||
| 246 | end)(fn_many_args()) | ||
| 247 | end)(fn(true)) | ||
| 248 | end | ||
| 249 | do | ||
| 250 | (function(...) | ||
| 251 | return print(...) | ||
| 252 | end)((function() | ||
| 253 | if true then | ||
| 254 | return 1, 2 | ||
| 255 | end | ||
| 256 | end)()) | ||
| 257 | end | ||
| 258 | do | ||
| 259 | (function(_arg_0, ...) | ||
| 260 | local a = _arg_0 | ||
| 261 | return print(a, select('#', ...)) | ||
| 262 | end)((function() | ||
| 263 | if not true then | ||
| 264 | return 1, 2 | ||
| 265 | end | ||
| 266 | end)()) | ||
| 267 | end | ||
| 223 | return nil | 268 | return nil |
| 224 | end | 269 | end |
