diff options
author | Li Jin <dragon-fly@qq.com> | 2025-04-11 17:33:12 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2025-04-11 17:33:12 +0800 |
commit | e96308912e2e04535836a2c282b0a7300d2d81fd (patch) | |
tree | 9c6f55dbce6193dac6f78dad94f76ad1c0a6ef1a /spec/outputs | |
parent | 9750786a5c03b5ce3ea22b240d1b3cd34990856b (diff) | |
download | yuescript-e96308912e2e04535836a2c282b0a7300d2d81fd.tar.gz yuescript-e96308912e2e04535836a2c282b0a7300d2d81fd.tar.bz2 yuescript-e96308912e2e04535836a2c282b0a7300d2d81fd.zip |
Fixing issue #206.v0.27.4
Diffstat (limited to 'spec/outputs')
-rw-r--r-- | spec/outputs/5.1/attrib.lua | 18 | ||||
-rw-r--r-- | spec/outputs/5.1/try_catch.lua | 6 | ||||
-rw-r--r-- | spec/outputs/assign.lua | 6 | ||||
-rw-r--r-- | spec/outputs/attrib.lua | 18 | ||||
-rw-r--r-- | spec/outputs/do.lua | 6 | ||||
-rw-r--r-- | spec/outputs/syntax.lua | 8 | ||||
-rw-r--r-- | spec/outputs/try_catch.lua | 6 | ||||
-rw-r--r-- | spec/outputs/unicode/assign.lua | 6 | ||||
-rw-r--r-- | spec/outputs/unicode/attrib.lua | 18 | ||||
-rw-r--r-- | spec/outputs/unicode/do.lua | 6 | ||||
-rw-r--r-- | spec/outputs/unicode/macro.lua | 113 | ||||
-rw-r--r-- | spec/outputs/unicode/syntax.lua | 8 | ||||
-rw-r--r-- | spec/outputs/unicode/try_catch.lua | 10 |
13 files changed, 140 insertions, 89 deletions
diff --git a/spec/outputs/5.1/attrib.lua b/spec/outputs/5.1/attrib.lua index a156e84..bda24bc 100644 --- a/spec/outputs/5.1/attrib.lua +++ b/spec/outputs/5.1/attrib.lua | |||
@@ -136,9 +136,11 @@ do | |||
136 | end | 136 | end |
137 | local b | 137 | local b |
138 | if not false then | 138 | if not false then |
139 | if x then | 139 | b = ((function() |
140 | b = 1 | 140 | if x then |
141 | end | 141 | return 1 |
142 | end | ||
143 | end)()) | ||
142 | end | 144 | end |
143 | local _close_0 | 145 | local _close_0 |
144 | if (function() | 146 | if (function() |
@@ -164,10 +166,12 @@ do | |||
164 | end)(pcall(function() | 166 | end)(pcall(function() |
165 | local c | 167 | local c |
166 | if true then | 168 | if true then |
167 | local _exp_0 = x | 169 | c = ((function() |
168 | if "abc" == _exp_0 then | 170 | local _exp_0 = x |
169 | c = 998 | 171 | if "abc" == _exp_0 then |
170 | end | 172 | return 998 |
173 | end | ||
174 | end)()) | ||
171 | end | 175 | end |
172 | local d | 176 | local d |
173 | if (function() | 177 | if (function() |
diff --git a/spec/outputs/5.1/try_catch.lua b/spec/outputs/5.1/try_catch.lua index d4c80c1..efd92c6 100644 --- a/spec/outputs/5.1/try_catch.lua +++ b/spec/outputs/5.1/try_catch.lua | |||
@@ -8,10 +8,10 @@ local _anon_func_2 = function(tb) | |||
8 | return tb.func() | 8 | return tb.func() |
9 | end | 9 | end |
10 | local _anon_func_3 = function(tb) | 10 | local _anon_func_3 = function(tb) |
11 | return tb.func() | 11 | return (tb.func()) |
12 | end | 12 | end |
13 | local _anon_func_4 = function(tb) | 13 | local _anon_func_4 = function(tb) |
14 | return tb:func(1, 2, 3) | 14 | return (tb:func(1, 2, 3)) |
15 | end | 15 | end |
16 | local _anon_func_5 = function(tb) | 16 | local _anon_func_5 = function(tb) |
17 | return tb.func(1) | 17 | return tb.func(1) |
@@ -64,7 +64,7 @@ f = function() | |||
64 | print("OK") | 64 | print("OK") |
65 | end | 65 | end |
66 | if xpcall(function() | 66 | if xpcall(function() |
67 | return func(1) | 67 | return (func(1)) |
68 | end, function(err) | 68 | end, function(err) |
69 | return print(err) | 69 | return print(err) |
70 | end) then | 70 | end) then |
diff --git a/spec/outputs/assign.lua b/spec/outputs/assign.lua index f889865..162c5a8 100644 --- a/spec/outputs/assign.lua +++ b/spec/outputs/assign.lua | |||
@@ -36,10 +36,10 @@ local x | |||
36 | do | 36 | do |
37 | local f = getHandler() | 37 | local f = getHandler() |
38 | if f then | 38 | if f then |
39 | do | 39 | x = ((function() |
40 | f() | 40 | f() |
41 | x = 123 | 41 | return 123 |
42 | end | 42 | end)()) |
43 | end | 43 | end |
44 | end | 44 | end |
45 | local _anon_func_0 = function(print) | 45 | local _anon_func_0 = function(print) |
diff --git a/spec/outputs/attrib.lua b/spec/outputs/attrib.lua index e48963c..bb9916c 100644 --- a/spec/outputs/attrib.lua +++ b/spec/outputs/attrib.lua | |||
@@ -56,17 +56,21 @@ do | |||
56 | end | 56 | end |
57 | local b | 57 | local b |
58 | if not false then | 58 | if not false then |
59 | if x then | 59 | b = ((function() |
60 | b = 1 | 60 | if x then |
61 | end | 61 | return 1 |
62 | end | ||
63 | end)()) | ||
62 | end | 64 | end |
63 | local _close_0 <close> = b | 65 | local _close_0 <close> = b |
64 | local c | 66 | local c |
65 | if true then | 67 | if true then |
66 | local _exp_0 = x | 68 | c = ((function() |
67 | if "abc" == _exp_0 then | 69 | local _exp_0 = x |
68 | c = 998 | 70 | if "abc" == _exp_0 then |
69 | end | 71 | return 998 |
72 | end | ||
73 | end)()) | ||
70 | end | 74 | end |
71 | local d | 75 | local d |
72 | if (function() | 76 | if (function() |
diff --git a/spec/outputs/do.lua b/spec/outputs/do.lua index 6473e03..96d1022 100644 --- a/spec/outputs/do.lua +++ b/spec/outputs/do.lua | |||
@@ -32,10 +32,10 @@ local t = { | |||
32 | } | 32 | } |
33 | return function(y, k) | 33 | return function(y, k) |
34 | if y == nil then | 34 | if y == nil then |
35 | do | 35 | y = ((function() |
36 | x = 10 + 2 | 36 | x = 10 + 2 |
37 | y = x | 37 | return x |
38 | end | 38 | end)()) |
39 | end | 39 | end |
40 | if k == nil then | 40 | if k == nil then |
41 | do | 41 | do |
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua index 5fd1821..040a325 100644 --- a/spec/outputs/syntax.lua +++ b/spec/outputs/syntax.lua | |||
@@ -239,9 +239,11 @@ x = 0 | |||
239 | local _list_0 = values | 239 | local _list_0 = values |
240 | for _index_0 = 1, #_list_0 do | 240 | for _index_0 = 1, #_list_0 do |
241 | local v = _list_0[_index_0] | 241 | local v = _list_0[_index_0] |
242 | if ntype(v) == "fndef" then | 242 | _ = ((function() |
243 | _ = x + 1 | 243 | if ntype(v) == "fndef" then |
244 | end | 244 | return x + 1 |
245 | end | ||
246 | end)()) | ||
245 | end | 247 | end |
246 | hello = { | 248 | hello = { |
247 | something = world, | 249 | something = world, |
diff --git a/spec/outputs/try_catch.lua b/spec/outputs/try_catch.lua index d4c80c1..efd92c6 100644 --- a/spec/outputs/try_catch.lua +++ b/spec/outputs/try_catch.lua | |||
@@ -8,10 +8,10 @@ local _anon_func_2 = function(tb) | |||
8 | return tb.func() | 8 | return tb.func() |
9 | end | 9 | end |
10 | local _anon_func_3 = function(tb) | 10 | local _anon_func_3 = function(tb) |
11 | return tb.func() | 11 | return (tb.func()) |
12 | end | 12 | end |
13 | local _anon_func_4 = function(tb) | 13 | local _anon_func_4 = function(tb) |
14 | return tb:func(1, 2, 3) | 14 | return (tb:func(1, 2, 3)) |
15 | end | 15 | end |
16 | local _anon_func_5 = function(tb) | 16 | local _anon_func_5 = function(tb) |
17 | return tb.func(1) | 17 | return tb.func(1) |
@@ -64,7 +64,7 @@ f = function() | |||
64 | print("OK") | 64 | print("OK") |
65 | end | 65 | end |
66 | if xpcall(function() | 66 | if xpcall(function() |
67 | return func(1) | 67 | return (func(1)) |
68 | end, function(err) | 68 | end, function(err) |
69 | return print(err) | 69 | return print(err) |
70 | end) then | 70 | end) then |
diff --git a/spec/outputs/unicode/assign.lua b/spec/outputs/unicode/assign.lua index bf43953..d4ad56a 100644 --- a/spec/outputs/unicode/assign.lua +++ b/spec/outputs/unicode/assign.lua | |||
@@ -36,10 +36,10 @@ local _u53d8_u91cfx | |||
36 | do | 36 | do |
37 | local _u51fd_u6570 = _u83b7_u53d6_u5904_u7406_u51fd_u6570() | 37 | local _u51fd_u6570 = _u83b7_u53d6_u5904_u7406_u51fd_u6570() |
38 | if _u51fd_u6570 then | 38 | if _u51fd_u6570 then |
39 | do | 39 | _u53d8_u91cfx = ((function() |
40 | _u51fd_u6570() | 40 | _u51fd_u6570() |
41 | _u53d8_u91cfx = 123 | 41 | return 123 |
42 | end | 42 | end)()) |
43 | end | 43 | end |
44 | end | 44 | end |
45 | local _anon_func_0 = function(_u6253_u5370) | 45 | local _anon_func_0 = function(_u6253_u5370) |
diff --git a/spec/outputs/unicode/attrib.lua b/spec/outputs/unicode/attrib.lua index 1c48de4..5e5bb99 100644 --- a/spec/outputs/unicode/attrib.lua +++ b/spec/outputs/unicode/attrib.lua | |||
@@ -48,17 +48,21 @@ do | |||
48 | end | 48 | end |
49 | local _u5173_u95ed_u53d8_u91cfb | 49 | local _u5173_u95ed_u53d8_u91cfb |
50 | if not false then | 50 | if not false then |
51 | if _u6761_u4ef6x then | 51 | _u5173_u95ed_u53d8_u91cfb = ((function() |
52 | _u5173_u95ed_u53d8_u91cfb = 1 | 52 | if _u6761_u4ef6x then |
53 | end | 53 | return 1 |
54 | end | ||
55 | end)()) | ||
54 | end | 56 | end |
55 | local _close_0 <close> = _u5173_u95ed_u53d8_u91cfb | 57 | local _close_0 <close> = _u5173_u95ed_u53d8_u91cfb |
56 | local _u5e38_u91cfc | 58 | local _u5e38_u91cfc |
57 | if true then | 59 | if true then |
58 | local _exp_0 = _u6761_u4ef6x | 60 | _u5e38_u91cfc = ((function() |
59 | if "abc" == _exp_0 then | 61 | local _exp_0 = _u6761_u4ef6x |
60 | _u5e38_u91cfc = 998 | 62 | if "abc" == _exp_0 then |
61 | end | 63 | return 998 |
64 | end | ||
65 | end)()) | ||
62 | end | 66 | end |
63 | local _u5173_u95ed_u53d8_u91cfd | 67 | local _u5173_u95ed_u53d8_u91cfd |
64 | if (function() | 68 | if (function() |
diff --git a/spec/outputs/unicode/do.lua b/spec/outputs/unicode/do.lua index f9c3079..7bf1da3 100644 --- a/spec/outputs/unicode/do.lua +++ b/spec/outputs/unicode/do.lua | |||
@@ -32,10 +32,10 @@ local _u53d8_u91cft = { | |||
32 | } | 32 | } |
33 | return function(_u53c2_u6570y, _u53c2_u6570k) | 33 | return function(_u53c2_u6570y, _u53c2_u6570k) |
34 | if _u53c2_u6570y == nil then | 34 | if _u53c2_u6570y == nil then |
35 | do | 35 | _u53c2_u6570y = ((function() |
36 | _u53d8_u91cfx = 10 + 2 | 36 | _u53d8_u91cfx = 10 + 2 |
37 | _u53c2_u6570y = _u53d8_u91cfx | 37 | return _u53d8_u91cfx |
38 | end | 38 | end)()) |
39 | end | 39 | end |
40 | if _u53c2_u6570k == nil then | 40 | if _u53c2_u6570k == nil then |
41 | do | 41 | do |
diff --git a/spec/outputs/unicode/macro.lua b/spec/outputs/unicode/macro.lua index 099080f..b14f571 100644 --- a/spec/outputs/unicode/macro.lua +++ b/spec/outputs/unicode/macro.lua | |||
@@ -215,52 +215,85 @@ do | |||
215 | -- 这有个注释 | 215 | -- 这有个注释 |
216 | end | 216 | end |
217 | local _ = require('下划线') | 217 | local _ = require('下划线') |
218 | local _call_0 = (_({ | 218 | local _anon_func_0 = function(_) |
219 | 1, | 219 | do |
220 | 2, | 220 | local _call_0 = (_({ |
221 | 3, | 221 | 1, |
222 | 4, | 222 | 2, |
223 | -2, | 223 | 3, |
224 | 3 | 224 | 4, |
225 | })) | 225 | -2, |
226 | _call_0 = _call_0["链"](_call_0) | 226 | 3 |
227 | _call_0 = _call_0["映射"](_call_0, function(self) | 227 | })) |
228 | return self * 2 | 228 | return _call_0["链"](_call_0) |
229 | end) | 229 | end |
230 | _call_0 = _call_0["过滤"](_call_0, function(self) | 230 | end |
231 | return self > 3 | 231 | local _call_0 = ((function() |
232 | end) | 232 | local _call_0 = ((function() |
233 | local _u7ed3_u679ca = _call_0["取值"](_call_0) | 233 | local _call_0 = (_anon_func_0(_)) |
234 | do | 234 | return _call_0["映射"](_call_0, function(self) |
235 | local _call_1 = (_({ | 235 | return self * 2 |
236 | 1, | 236 | end) |
237 | 2, | 237 | end)()) |
238 | 3, | 238 | return _call_0["过滤"](_call_0, function(self) |
239 | 4, | ||
240 | -2, | ||
241 | 3 | ||
242 | })) | ||
243 | _call_1 = _call_1["链"](_call_1) | ||
244 | _call_1 = _call_1["映射"](_call_1, function(self) | ||
245 | return self * 2 | ||
246 | end) | ||
247 | _call_1 = _call_1["过滤"](_call_1, function(self) | ||
248 | return self > 3 | 239 | return self > 3 |
249 | end) | 240 | end) |
241 | end)()) | ||
242 | local _u7ed3_u679ca = _call_0["取值"](_call_0) | ||
243 | local _anon_func_1 = function(_) | ||
244 | do | ||
245 | local _call_1 = (_({ | ||
246 | 1, | ||
247 | 2, | ||
248 | 3, | ||
249 | 4, | ||
250 | -2, | ||
251 | 3 | ||
252 | })) | ||
253 | return _call_1["链"](_call_1) | ||
254 | end | ||
255 | end | ||
256 | do | ||
257 | local _call_1 = ((function() | ||
258 | local _call_1 = ((function() | ||
259 | local _call_1 = (_anon_func_1(_)) | ||
260 | return _call_1["映射"](_call_1, function(self) | ||
261 | return self * 2 | ||
262 | end) | ||
263 | end)()) | ||
264 | return _call_1["过滤"](_call_1, function(self) | ||
265 | return self > 3 | ||
266 | end) | ||
267 | end)()) | ||
250 | _call_1["每一个"](_call_1, function(self) | 268 | _call_1["每一个"](_call_1, function(self) |
251 | return _u6253_u5370(self) | 269 | return _u6253_u5370(self) |
252 | end) | 270 | end) |
253 | end | 271 | end |
254 | local _call_1 = _u539f_u70b9["变换"]["根节点"]["游戏对象"] | 272 | local _anon_func_2 = function(_u539f_u70b9) |
255 | _call_1 = _call_1["父节点"](_call_1) | 273 | do |
256 | _call_1 = _call_1["后代"](_call_1) | 274 | local _call_1 = _u539f_u70b9["变换"]["根节点"]["游戏对象"] |
257 | _call_1 = _call_1["选择启用"](_call_1) | 275 | return _call_1["父节点"](_call_1) |
258 | _call_1 = _call_1["选择可见"](_call_1) | 276 | end |
259 | _call_1 = _call_1["标签等于"](_call_1, "fx") | 277 | end |
260 | _call_1 = _call_1["其中"](_call_1, function(x) | 278 | local _call_1 = ((function() |
261 | local _call_2 = x["名称"] | 279 | local _call_1 = ((function() |
262 | return _call_2["结尾为"](_call_2, "(克隆)") | 280 | local _call_1 = ((function() |
263 | end) | 281 | local _call_1 = ((function() |
282 | local _call_1 = ((function() | ||
283 | local _call_1 = (_anon_func_2(_u539f_u70b9)) | ||
284 | return _call_1["后代"](_call_1) | ||
285 | end)()) | ||
286 | return _call_1["选择启用"](_call_1) | ||
287 | end)()) | ||
288 | return _call_1["选择可见"](_call_1) | ||
289 | end)()) | ||
290 | return _call_1["标签等于"](_call_1, "fx") | ||
291 | end)()) | ||
292 | return _call_1["其中"](_call_1, function(x) | ||
293 | local _call_2 = x["名称"] | ||
294 | return _call_2["结尾为"](_call_2, "(克隆)") | ||
295 | end) | ||
296 | end)()) | ||
264 | _u7ed3_u679c = _call_1["摧毁"](_call_1) | 297 | _u7ed3_u679c = _call_1["摧毁"](_call_1) |
265 | do | 298 | do |
266 | do | 299 | do |
diff --git a/spec/outputs/unicode/syntax.lua b/spec/outputs/unicode/syntax.lua index ea97bb9..1984f40 100644 --- a/spec/outputs/unicode/syntax.lua +++ b/spec/outputs/unicode/syntax.lua | |||
@@ -258,9 +258,11 @@ _u53d8_u91cfx = 0 | |||
258 | local _list_0 = _u503c | 258 | local _list_0 = _u503c |
259 | for _index_0 = 1, #_list_0 do | 259 | for _index_0 = 1, #_list_0 do |
260 | local _u53d8_u91cfv = _list_0[_index_0] | 260 | local _u53d8_u91cfv = _list_0[_index_0] |
261 | if ntype(_u53d8_u91cfv) == "函数定义" then | 261 | _ = ((function() |
262 | _ = _u53d8_u91cfx + 1 | 262 | if ntype(_u53d8_u91cfv) == "函数定义" then |
263 | end | 263 | return _u53d8_u91cfx + 1 |
264 | end | ||
265 | end)()) | ||
264 | end | 266 | end |
265 | _u4f60_u597d = { | 267 | _u4f60_u597d = { |
266 | ["某物"] = _u4e16_u754c, | 268 | ["某物"] = _u4e16_u754c, |
diff --git a/spec/outputs/unicode/try_catch.lua b/spec/outputs/unicode/try_catch.lua index 22f29f9..f8c7849 100644 --- a/spec/outputs/unicode/try_catch.lua +++ b/spec/outputs/unicode/try_catch.lua | |||
@@ -32,11 +32,13 @@ pcall(function() | |||
32 | return _u8868["函数"]() | 32 | return _u8868["函数"]() |
33 | end) | 33 | end) |
34 | pcall(function() | 34 | pcall(function() |
35 | return _u8868["函数"]() | 35 | return (_u8868["函数"]()) |
36 | end) | 36 | end) |
37 | pcall(function() | 37 | pcall(function() |
38 | local _call_0 = _u8868 | 38 | return ((function() |
39 | return _call_0["函数"](_call_0, 1, 2, 3) | 39 | local _call_0 = _u8868 |
40 | return _call_0["函数"](_call_0, 1, 2, 3) | ||
41 | end)()) | ||
40 | end) | 42 | end) |
41 | pcall(function() | 43 | pcall(function() |
42 | return _u8868["函数"](1) | 44 | return _u8868["函数"](1) |
@@ -52,7 +54,7 @@ end)) then | |||
52 | _u6253_u5370("好的") | 54 | _u6253_u5370("好的") |
53 | end | 55 | end |
54 | if xpcall(function() | 56 | if xpcall(function() |
55 | return _u51fd_u6570(1) | 57 | return (_u51fd_u6570(1)) |
56 | end, function(_u9519_u8bef) | 58 | end, function(_u9519_u8bef) |
57 | return _u6253_u5370(_u9519_u8bef) | 59 | return _u6253_u5370(_u9519_u8bef) |
58 | end) then | 60 | end) then |