aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-03-14 13:46:17 +0800
committerLi Jin <dragon-fly@qq.com>2022-03-14 13:46:17 +0800
commit0055f2fdb169788a7796821d20c7fba2230ea9ae (patch)
tree24ecbf48a03e2d4690a51d66e087f4585d196754 /spec
parent985761356280bf8625a6568dd83822aae83edc8f (diff)
downloadyuescript-0055f2fdb169788a7796821d20c7fba2230ea9ae.tar.gz
yuescript-0055f2fdb169788a7796821d20c7fba2230ea9ae.tar.bz2
yuescript-0055f2fdb169788a7796821d20c7fba2230ea9ae.zip
fix more cases that global values are not being cached.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/cond.yue11
-rw-r--r--spec/inputs/with.yue13
-rw-r--r--spec/outputs/cond.lua22
-rw-r--r--spec/outputs/with.lua37
4 files changed, 79 insertions, 4 deletions
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue
index 42b22a7..773ef91 100644
--- a/spec/inputs/cond.yue
+++ b/spec/inputs/cond.yue
@@ -208,6 +208,17 @@ do
208 if :pi = math 208 if :pi = math
209 print pi 209 print pi
210 210
211do
212 if _M = {}
213 :Thing = _M
214 :a, :b = _M
215
216do
217 global _M
218 if _M = {}
219 :Thing = _M
220 :a, :b = _M
221
211nil 222nil
212 223
213 224
diff --git a/spec/inputs/with.yue b/spec/inputs/with.yue
index d88e109..fe140ac 100644
--- a/spec/inputs/with.yue
+++ b/spec/inputs/with.yue
@@ -121,3 +121,16 @@ do
121 with dad 121 with dad
122 .if "yes" 122 .if "yes"
123 y = .end.of.function 123 y = .end.of.function
124
125do
126 global mask
127 with? mask = SolidRect width: w, height: h, color: 0x66000000
128 .touchEnabled = true
129 .swallowTouches = true
130
131do
132 with? mask = SolidRect width: w, height: h, color: 0x66000000
133 .touchEnabled = true
134 .swallowTouches = true
135
136nil
diff --git a/spec/outputs/cond.lua b/spec/outputs/cond.lua
index 4dc5aa5..178bf9b 100644
--- a/spec/outputs/cond.lua
+++ b/spec/outputs/cond.lua
@@ -313,4 +313,26 @@ do
313 print(pi) 313 print(pi)
314 end 314 end
315end 315end
316do
317 do
318 local _M = { }
319 if _M then
320 local Thing = _M.Thing
321 a, b = _M.a, _M.b
322 end
323 end
324end
325do
326 do
327 local _des_0 = { }
328 if _des_0 then
329 _M = _des_0
330 local Thing = _M.Thing
331 do
332 local _obj_0 = _M
333 a, b = _obj_0.a, _obj_0.b
334 end
335 end
336 end
337end
316return nil 338return nil
diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua
index e1497c6..f172b01 100644
--- a/spec/outputs/with.lua
+++ b/spec/outputs/with.lua
@@ -157,8 +157,37 @@ do
157 end 157 end
158end 158end
159do 159do
160 local _with_0 = dad 160 do
161 _with_0["if"]("yes") 161 local _with_0 = dad
162 local y = _with_0["end"].of["function"] 162 _with_0["if"]("yes")
163 return _with_0 163 local y = _with_0["end"].of["function"]
164 end
165end
166do
167 do
168 local _with_0 = SolidRect({
169 width = w,
170 height = h,
171 color = 0x66000000
172 })
173 mask = _with_0
174 if _with_0 ~= nil then
175 _with_0.touchEnabled = true
176 _with_0.swallowTouches = true
177 end
178 end
179end
180do
181 do
182 local mask = SolidRect({
183 width = w,
184 height = h,
185 color = 0x66000000
186 })
187 if mask ~= nil then
188 mask.touchEnabled = true
189 mask.swallowTouches = true
190 end
191 end
164end 192end
193return nil