diff options
author | Li Jin <dragon-fly@qq.com> | 2023-01-29 10:29:19 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-01-29 10:29:19 +0800 |
commit | e10b1b163a9a173f32b956bf1fb9be00194352b5 (patch) | |
tree | 4692fe729bbb588c0565ce78426c932e8b360f22 /spec | |
parent | 32f2a579ec15e6204e44d67ab2b8b4a1796e9a84 (diff) | |
download | yuescript-e10b1b163a9a173f32b956bf1fb9be00194352b5.tar.gz yuescript-e10b1b163a9a173f32b956bf1fb9be00194352b5.tar.bz2 yuescript-e10b1b163a9a173f32b956bf1fb9be00194352b5.zip |
fix cases from issue #120.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/loops.yue | 6 | ||||
-rw-r--r-- | spec/inputs/return.yue | 2 | ||||
-rw-r--r-- | spec/outputs/5.1/loops.lua | 3 | ||||
-rw-r--r-- | spec/outputs/loops.lua | 3 |
4 files changed, 11 insertions, 3 deletions
diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue index d997c65..51eb10b 100644 --- a/spec/inputs/loops.yue +++ b/spec/inputs/loops.yue | |||
@@ -75,15 +75,17 @@ while also do | |||
75 | i = 0 | 75 | i = 0 |
76 | x = while i < 10 | 76 | x = while i < 10 |
77 | i += 1 | 77 | i += 1 |
78 | i | ||
78 | 79 | ||
79 | -- values that can'e be coerced | 80 | -- values that can't be coerced |
80 | 81 | ||
81 | x = for thing in *3 | 82 | x = for thing in *3 |
82 | y = "hello" | 83 | y = "hello" |
84 | break | ||
83 | 85 | ||
84 | x = for x=1,2 | 86 | x = for x=1,2 |
85 | y = "hello" | 87 | y = "hello" |
86 | 88 | y | |
87 | 89 | ||
88 | -- continue | 90 | -- continue |
89 | 91 | ||
diff --git a/spec/inputs/return.yue b/spec/inputs/return.yue index 96fa0cd..fda8d62 100644 --- a/spec/inputs/return.yue +++ b/spec/inputs/return.yue | |||
@@ -6,7 +6,7 @@ _ = -> [x for x in *things] | |||
6 | 6 | ||
7 | -- doesn't make sense on purpose | 7 | -- doesn't make sense on purpose |
8 | do | 8 | do |
9 | return x for x in *things | 9 | for x in *things do return x |
10 | 10 | ||
11 | do | 11 | do |
12 | return [x for x in *things] | 12 | return [x for x in *things] |
diff --git a/spec/outputs/5.1/loops.lua b/spec/outputs/5.1/loops.lua index a3b9548..85e9de8 100644 --- a/spec/outputs/5.1/loops.lua +++ b/spec/outputs/5.1/loops.lua | |||
@@ -125,6 +125,7 @@ do | |||
125 | local _len_0 = 1 | 125 | local _len_0 = 1 |
126 | while i < 10 do | 126 | while i < 10 do |
127 | i = i + 1 | 127 | i = i + 1 |
128 | _accum_0[_len_0] = i | ||
128 | _len_0 = _len_0 + 1 | 129 | _len_0 = _len_0 + 1 |
129 | end | 130 | end |
130 | x = _accum_0 | 131 | x = _accum_0 |
@@ -136,6 +137,7 @@ do | |||
136 | for _index_0 = 1, #_list_2 do | 137 | for _index_0 = 1, #_list_2 do |
137 | local thing = _list_2[_index_0] | 138 | local thing = _list_2[_index_0] |
138 | y = "hello" | 139 | y = "hello" |
140 | break | ||
139 | _len_0 = _len_0 + 1 | 141 | _len_0 = _len_0 + 1 |
140 | end | 142 | end |
141 | x = _accum_0 | 143 | x = _accum_0 |
@@ -145,6 +147,7 @@ do | |||
145 | local _len_0 = 1 | 147 | local _len_0 = 1 |
146 | for x = 1, 2 do | 148 | for x = 1, 2 do |
147 | y = "hello" | 149 | y = "hello" |
150 | _accum_0[_len_0] = y | ||
148 | _len_0 = _len_0 + 1 | 151 | _len_0 = _len_0 + 1 |
149 | end | 152 | end |
150 | x = _accum_0 | 153 | x = _accum_0 |
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index 9c16ee4..eeea15f 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua | |||
@@ -125,6 +125,7 @@ do | |||
125 | local _len_0 = 1 | 125 | local _len_0 = 1 |
126 | while i < 10 do | 126 | while i < 10 do |
127 | i = i + 1 | 127 | i = i + 1 |
128 | _accum_0[_len_0] = i | ||
128 | _len_0 = _len_0 + 1 | 129 | _len_0 = _len_0 + 1 |
129 | end | 130 | end |
130 | x = _accum_0 | 131 | x = _accum_0 |
@@ -136,6 +137,7 @@ do | |||
136 | for _index_0 = 1, #_list_2 do | 137 | for _index_0 = 1, #_list_2 do |
137 | local thing = _list_2[_index_0] | 138 | local thing = _list_2[_index_0] |
138 | y = "hello" | 139 | y = "hello" |
140 | break | ||
139 | _len_0 = _len_0 + 1 | 141 | _len_0 = _len_0 + 1 |
140 | end | 142 | end |
141 | x = _accum_0 | 143 | x = _accum_0 |
@@ -145,6 +147,7 @@ do | |||
145 | local _len_0 = 1 | 147 | local _len_0 = 1 |
146 | for x = 1, 2 do | 148 | for x = 1, 2 do |
147 | y = "hello" | 149 | y = "hello" |
150 | _accum_0[_len_0] = y | ||
148 | _len_0 = _len_0 + 1 | 151 | _len_0 = _len_0 + 1 |
149 | end | 152 | end |
150 | x = _accum_0 | 153 | x = _accum_0 |