diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-03-23 17:25:28 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-03-23 17:25:28 +0800 |
| commit | 08b68269ff6d6f868242dcefce75e1db26e4de61 (patch) | |
| tree | 3c63e851edc5baa49ad0d180021c2ddecd77f013 /spec | |
| parent | 28bae6517f43c384a828df62b727517e26b3af9b (diff) | |
| download | yuescript-08b68269ff6d6f868242dcefce75e1db26e4de61.tar.gz yuescript-08b68269ff6d6f868242dcefce75e1db26e4de61.tar.bz2 yuescript-08b68269ff6d6f868242dcefce75e1db26e4de61.zip | |
Fixed issue #198.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/outputs/class.lua | 44 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 10 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 10 | ||||
| -rw-r--r-- | spec/outputs/cond.lua | 14 | ||||
| -rw-r--r-- | spec/outputs/unicode/cond.lua | 16 | ||||
| -rw-r--r-- | spec/outputs/unicode/with.lua | 20 | ||||
| -rw-r--r-- | spec/outputs/with.lua | 20 |
7 files changed, 60 insertions, 74 deletions
diff --git a/spec/outputs/class.lua b/spec/outputs/class.lua index aaea33c..07efde4 100644 --- a/spec/outputs/class.lua +++ b/spec/outputs/class.lua | |||
| @@ -1231,30 +1231,28 @@ do | |||
| 1231 | end | 1231 | end |
| 1232 | do | 1232 | do |
| 1233 | local CX | 1233 | local CX |
| 1234 | do | 1234 | local _class_0 |
| 1235 | local _class_0 | 1235 | local _base_0 = { } |
| 1236 | local _base_0 = { } | 1236 | if _base_0.__index == nil then |
| 1237 | if _base_0.__index == nil then | 1237 | _base_0.__index = _base_0 |
| 1238 | _base_0.__index = _base_0 | ||
| 1239 | end | ||
| 1240 | _class_0 = setmetatable({ | ||
| 1241 | __init = function(self) end, | ||
| 1242 | __base = _base_0, | ||
| 1243 | __name = "CX" | ||
| 1244 | }, { | ||
| 1245 | __index = _base_0, | ||
| 1246 | __call = function(cls, ...) | ||
| 1247 | local _self_0 = setmetatable({ }, _base_0) | ||
| 1248 | cls.__init(_self_0, ...) | ||
| 1249 | return _self_0 | ||
| 1250 | end | ||
| 1251 | }) | ||
| 1252 | _base_0.__class = _class_0 | ||
| 1253 | local self = _class_0; | ||
| 1254 | xa = 1 | ||
| 1255 | xb = 1 | ||
| 1256 | CX = _class_0 | ||
| 1257 | end | 1238 | end |
| 1239 | _class_0 = setmetatable({ | ||
| 1240 | __init = function(self) end, | ||
| 1241 | __base = _base_0, | ||
| 1242 | __name = "CX" | ||
| 1243 | }, { | ||
| 1244 | __index = _base_0, | ||
| 1245 | __call = function(cls, ...) | ||
| 1246 | local _self_0 = setmetatable({ }, _base_0) | ||
| 1247 | cls.__init(_self_0, ...) | ||
| 1248 | return _self_0 | ||
| 1249 | end | ||
| 1250 | }) | ||
| 1251 | _base_0.__class = _class_0 | ||
| 1252 | local self = _class_0; | ||
| 1253 | xa = 1 | ||
| 1254 | xb = 1 | ||
| 1255 | CX = _class_0 | ||
| 1258 | end | 1256 | end |
| 1259 | do | 1257 | do |
| 1260 | local CY | 1258 | local CY |
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index a37b459..27f8de5 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
| @@ -486,17 +486,16 @@ end | |||
| 486 | do | 486 | do |
| 487 | a = 1 | 487 | a = 1 |
| 488 | print("declare all variables as globals") | 488 | print("declare all variables as globals") |
| 489 | local x | ||
| 490 | x = function() | 489 | x = function() |
| 491 | return 1 + y + z | 490 | return 1 + y + z |
| 492 | end | 491 | end |
| 493 | local y, z = 2, 3 | 492 | y, z = 2, 3 |
| 494 | end | 493 | end |
| 495 | do | 494 | do |
| 496 | X = 1 | 495 | X = 1 |
| 497 | print("only declare upper case variables as globals") | 496 | print("only declare upper case variables as globals") |
| 498 | local a = 1 | 497 | local a = 1 |
| 499 | local B = 2 | 498 | B = 2 |
| 500 | local Temp = "a local value" | 499 | local Temp = "a local value" |
| 501 | end | 500 | end |
| 502 | local thing = { | 501 | local thing = { |
| @@ -2494,17 +2493,16 @@ end | |||
| 2494 | do | 2493 | do |
| 2495 | a = 1 | 2494 | a = 1 |
| 2496 | print("declare all variables as globals") | 2495 | print("declare all variables as globals") |
| 2497 | local x | ||
| 2498 | x = function() | 2496 | x = function() |
| 2499 | return 1 + y + z | 2497 | return 1 + y + z |
| 2500 | end | 2498 | end |
| 2501 | local y, z = 2, 3 | 2499 | y, z = 2, 3 |
| 2502 | end | 2500 | end |
| 2503 | do | 2501 | do |
| 2504 | X = 1 | 2502 | X = 1 |
| 2505 | print("only declare upper case variables as globals") | 2503 | print("only declare upper case variables as globals") |
| 2506 | local a = 1 | 2504 | local a = 1 |
| 2507 | local B = 2 | 2505 | B = 2 |
| 2508 | local Temp = "a local value" | 2506 | local Temp = "a local value" |
| 2509 | end | 2507 | end |
| 2510 | local thing = { | 2508 | local thing = { |
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index a23044d..ffa0483 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua | |||
| @@ -486,17 +486,16 @@ end | |||
| 486 | do | 486 | do |
| 487 | a = 1 | 487 | a = 1 |
| 488 | print("预先声明所有变量为全局变量") | 488 | print("预先声明所有变量为全局变量") |
| 489 | local x | ||
| 490 | x = function() | 489 | x = function() |
| 491 | return 1 + y + z | 490 | return 1 + y + z |
| 492 | end | 491 | end |
| 493 | local y, z = 2, 3 | 492 | y, z = 2, 3 |
| 494 | end | 493 | end |
| 495 | do | 494 | do |
| 496 | x = 1 | 495 | x = 1 |
| 497 | print("只预先声明大写的变量为全局变量") | 496 | print("只预先声明大写的变量为全局变量") |
| 498 | local a = 1 | 497 | local a = 1 |
| 499 | local B = 2 | 498 | B = 2 |
| 500 | local Temp = "一个局部值" | 499 | local Temp = "一个局部值" |
| 501 | end | 500 | end |
| 502 | local thing = { | 501 | local thing = { |
| @@ -2488,17 +2487,16 @@ end | |||
| 2488 | do | 2487 | do |
| 2489 | a = 1 | 2488 | a = 1 |
| 2490 | print("预先声明所有变量为全局变量") | 2489 | print("预先声明所有变量为全局变量") |
| 2491 | local x | ||
| 2492 | x = function() | 2490 | x = function() |
| 2493 | return 1 + y + z | 2491 | return 1 + y + z |
| 2494 | end | 2492 | end |
| 2495 | local y, z = 2, 3 | 2493 | y, z = 2, 3 |
| 2496 | end | 2494 | end |
| 2497 | do | 2495 | do |
| 2498 | x = 1 | 2496 | x = 1 |
| 2499 | print("只预先声明大写的变量为全局变量") | 2497 | print("只预先声明大写的变量为全局变量") |
| 2500 | local a = 1 | 2498 | local a = 1 |
| 2501 | local B = 2 | 2499 | B = 2 |
| 2502 | local Temp = "一个局部值" | 2500 | local Temp = "一个局部值" |
| 2503 | end | 2501 | end |
| 2504 | local thing = { | 2502 | local thing = { |
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua index 083419a..e194909 100644 --- a/spec/outputs/cond.lua +++ b/spec/outputs/cond.lua | |||
| @@ -313,14 +313,12 @@ do | |||
| 313 | end | 313 | end |
| 314 | end | 314 | end |
| 315 | do | 315 | do |
| 316 | do | 316 | local _des_0 = { } |
| 317 | local _des_0 = { } | 317 | if _des_0 then |
| 318 | if _des_0 then | 318 | _M = _des_0 |
| 319 | _M = _des_0 | 319 | local Thing = _M.Thing |
| 320 | local Thing = _M.Thing | 320 | local _obj_0 = _M |
| 321 | local _obj_0 = _M | 321 | a, b = _obj_0.a, _obj_0.b |
| 322 | a, b = _obj_0.a, _obj_0.b | ||
| 323 | end | ||
| 324 | end | 322 | end |
| 325 | end | 323 | end |
| 326 | do | 324 | do |
diff --git a/spec/outputs/unicode/cond.lua b/spec/outputs/unicode/cond.lua index 7229001..5e86228 100644 --- a/spec/outputs/unicode/cond.lua +++ b/spec/outputs/unicode/cond.lua | |||
| @@ -314,15 +314,13 @@ do | |||
| 314 | end | 314 | end |
| 315 | end | 315 | end |
| 316 | do | 316 | do |
| 317 | do | 317 | local _des_0 = { } |
| 318 | local _des_0 = { } | 318 | if _des_0 then |
| 319 | if _des_0 then | 319 | __u6a21_u5757 = _des_0 |
| 320 | __u6a21_u5757 = _des_0 | 320 | local _u4e1c_u897f = __u6a21_u5757["东西"] |
| 321 | local _u4e1c_u897f = __u6a21_u5757["东西"] | 321 | local a_u529f_u80fd, b_u529f_u80fd |
| 322 | local a_u529f_u80fd, b_u529f_u80fd | 322 | local _obj_0 = __u6a21_u5757 |
| 323 | local _obj_0 = __u6a21_u5757 | 323 | a_u529f_u80fd, b_u529f_u80fd = _obj_0["a功能"], _obj_0["b功能"] |
| 324 | a_u529f_u80fd, b_u529f_u80fd = _obj_0["a功能"], _obj_0["b功能"] | ||
| 325 | end | ||
| 326 | end | 324 | end |
| 327 | end | 325 | end |
| 328 | do | 326 | do |
diff --git a/spec/outputs/unicode/with.lua b/spec/outputs/unicode/with.lua index 7a5ba00..3a32a27 100644 --- a/spec/outputs/unicode/with.lua +++ b/spec/outputs/unicode/with.lua | |||
| @@ -161,17 +161,15 @@ do | |||
| 161 | } | 161 | } |
| 162 | end | 162 | end |
| 163 | do | 163 | do |
| 164 | do | 164 | local _with_0 = _u5b9e_u5fc3_u77e9_u5f62({ |
| 165 | local _with_0 = _u5b9e_u5fc3_u77e9_u5f62({ | 165 | ["宽"] = w, |
| 166 | ["宽"] = w, | 166 | ["高"] = h, |
| 167 | ["高"] = h, | 167 | ["颜色"] = 0x66000000 |
| 168 | ["颜色"] = 0x66000000 | 168 | }) |
| 169 | }) | 169 | _u63a9_u7801 = _with_0 |
| 170 | _u63a9_u7801 = _with_0 | 170 | if _with_0 ~= nil then |
| 171 | if _with_0 ~= nil then | 171 | _with_0["触摸启用"] = true |
| 172 | _with_0["触摸启用"] = true | 172 | _with_0["吞噬触摸"] = true |
| 173 | _with_0["吞噬触摸"] = true | ||
| 174 | end | ||
| 175 | end | 173 | end |
| 176 | end | 174 | end |
| 177 | do | 175 | do |
diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua index 5d33bdb..1a795c1 100644 --- a/spec/outputs/with.lua +++ b/spec/outputs/with.lua | |||
| @@ -158,17 +158,15 @@ do | |||
| 158 | } | 158 | } |
| 159 | end | 159 | end |
| 160 | do | 160 | do |
| 161 | do | 161 | local _with_0 = SolidRect({ |
| 162 | local _with_0 = SolidRect({ | 162 | width = w, |
| 163 | width = w, | 163 | height = h, |
| 164 | height = h, | 164 | color = 0x66000000 |
| 165 | color = 0x66000000 | 165 | }) |
| 166 | }) | 166 | mask = _with_0 |
| 167 | mask = _with_0 | 167 | if _with_0 ~= nil then |
| 168 | if _with_0 ~= nil then | 168 | _with_0.touchEnabled = true |
| 169 | _with_0.touchEnabled = true | 169 | _with_0.swallowTouches = true |
| 170 | _with_0.swallowTouches = true | ||
| 171 | end | ||
| 172 | end | 170 | end |
| 173 | end | 171 | end |
| 174 | do | 172 | do |
