diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/return.yue | 13 | ||||
-rw-r--r-- | spec/inputs/tables.yue | 23 | ||||
-rw-r--r-- | spec/outputs/return.lua | 24 | ||||
-rw-r--r-- | spec/outputs/tables.lua | 61 |
4 files changed, 121 insertions, 0 deletions
diff --git a/spec/inputs/return.yue b/spec/inputs/return.yue index f170ffd..96fa0cd 100644 --- a/spec/inputs/return.yue +++ b/spec/inputs/return.yue | |||
@@ -49,6 +49,19 @@ do | |||
49 | else | 49 | else |
50 | b | 50 | b |
51 | 51 | ||
52 | do | ||
53 | return | ||
54 | :value | ||
55 | itemA: 123 | ||
56 | itemB: "abc" | ||
57 | |||
58 | do | ||
59 | return | ||
60 | * 1 | ||
61 | * 2 | ||
62 | * ...three | ||
63 | * 4 | ||
64 | |||
52 | _ = -> a\b | 65 | _ = -> a\b |
53 | do a\b | 66 | do a\b |
54 | 67 | ||
diff --git a/spec/inputs/tables.yue b/spec/inputs/tables.yue index 3a245a7..e1b9e1d 100644 --- a/spec/inputs/tables.yue +++ b/spec/inputs/tables.yue | |||
@@ -281,5 +281,28 @@ specializedB = { | |||
281 | else: false | 281 | else: false |
282 | } | 282 | } |
283 | 283 | ||
284 | parts = | ||
285 | * "shoulders" | ||
286 | * "knees" | ||
287 | |||
288 | lyrics = | ||
289 | * "head" | ||
290 | * ...parts | ||
291 | * "and" | ||
292 | * "toes" | ||
293 | |||
294 | tbBlock = | ||
295 | sub: | ||
296 | :value | ||
297 | * ...items | ||
298 | * ... | ||
299 | |||
300 | func | ||
301 | * ...items | ||
302 | :value | ||
303 | * ... | ||
304 | k: v | ||
305 | * ... | ||
306 | |||
284 | nil | 307 | nil |
285 | 308 | ||
diff --git a/spec/outputs/return.lua b/spec/outputs/return.lua index 0735b23..775ae11 100644 --- a/spec/outputs/return.lua +++ b/spec/outputs/return.lua | |||
@@ -86,6 +86,30 @@ do | |||
86 | end | 86 | end |
87 | end | 87 | end |
88 | end | 88 | end |
89 | do | ||
90 | return { | ||
91 | value = value, | ||
92 | itemA = 123, | ||
93 | itemB = "abc" | ||
94 | } | ||
95 | end | ||
96 | do | ||
97 | local _tab_0 = { | ||
98 | 1, | ||
99 | 2 | ||
100 | } | ||
101 | local _idx_0 = 1 | ||
102 | for _key_0, _value_0 in pairs(three) do | ||
103 | if _idx_0 == _key_0 then | ||
104 | _tab_0[#_tab_0 + 1] = _value_0 | ||
105 | _idx_0 = _idx_0 + 1 | ||
106 | else | ||
107 | _tab_0[_key_0] = _value_0 | ||
108 | end | ||
109 | end | ||
110 | _tab_0[#_tab_0 + 1] = 4 | ||
111 | return _tab_0 | ||
112 | end | ||
89 | _ = function() | 113 | _ = function() |
90 | local _base_0 = a | 114 | local _base_0 = a |
91 | local _fn_0 = _base_0.b | 115 | local _fn_0 = _base_0.b |
diff --git a/spec/outputs/tables.lua b/spec/outputs/tables.lua index 165706d..1d28a43 100644 --- a/spec/outputs/tables.lua +++ b/spec/outputs/tables.lua | |||
@@ -527,4 +527,65 @@ do | |||
527 | _tab_0["else"] = false | 527 | _tab_0["else"] = false |
528 | specializedB = _tab_0 | 528 | specializedB = _tab_0 |
529 | end | 529 | end |
530 | local parts = { | ||
531 | "shoulders", | ||
532 | "knees" | ||
533 | } | ||
534 | local lyrics | ||
535 | do | ||
536 | local _tab_0 = { | ||
537 | "head" | ||
538 | } | ||
539 | local _idx_0 = 1 | ||
540 | for _key_0, _value_0 in pairs(parts) do | ||
541 | if _idx_0 == _key_0 then | ||
542 | _tab_0[#_tab_0 + 1] = _value_0 | ||
543 | _idx_0 = _idx_0 + 1 | ||
544 | else | ||
545 | _tab_0[_key_0] = _value_0 | ||
546 | end | ||
547 | end | ||
548 | _tab_0[#_tab_0 + 1] = "and" | ||
549 | _tab_0[#_tab_0 + 1] = "toes" | ||
550 | lyrics = _tab_0 | ||
551 | end | ||
552 | local tbBlock = { | ||
553 | sub = (function(...) | ||
554 | local _tab_0 = { | ||
555 | value = value | ||
556 | } | ||
557 | local _idx_0 = 1 | ||
558 | for _key_0, _value_0 in pairs(items) do | ||
559 | if _idx_0 == _key_0 then | ||
560 | _tab_0[#_tab_0 + 1] = _value_0 | ||
561 | _idx_0 = _idx_0 + 1 | ||
562 | else | ||
563 | _tab_0[_key_0] = _value_0 | ||
564 | end | ||
565 | end | ||
566 | for _index_0 = 1, select('#', ...) do | ||
567 | _tab_0[#_tab_0 + 1] = select(_index_0, ...) | ||
568 | end | ||
569 | return _tab_0 | ||
570 | end)(...) | ||
571 | } | ||
572 | func((function(...) | ||
573 | local _tab_0 = { } | ||
574 | local _idx_0 = 1 | ||
575 | for _key_0, _value_0 in pairs(items) do | ||
576 | if _idx_0 == _key_0 then | ||
577 | _tab_0[#_tab_0 + 1] = _value_0 | ||
578 | _idx_0 = _idx_0 + 1 | ||
579 | else | ||
580 | _tab_0[_key_0] = _value_0 | ||
581 | end | ||
582 | end | ||
583 | _tab_0.value = value | ||
584 | _tab_0[#_tab_0 + 1] = ... | ||
585 | _tab_0.k = v | ||
586 | for _index_0 = 1, select('#', ...) do | ||
587 | _tab_0[#_tab_0 + 1] = select(_index_0, ...) | ||
588 | end | ||
589 | return _tab_0 | ||
590 | end)(...)) | ||
530 | return nil | 591 | return nil |