aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/with.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2024-03-21 09:14:34 +0800
committerLi Jin <dragon-fly@qq.com>2024-03-21 09:14:34 +0800
commit4a3cc26c6dfd74e61c8b6480038d6a292ea86e47 (patch)
tree9554b94cfc15e4acee0c2e60b63af16f1b828207 /spec/outputs/with.lua
parent80b65520da432843f0c63431a1867bd2620bc4ac (diff)
downloadyuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.gz
yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.bz2
yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.zip
remove redundant 'do' blocks in code generation.
Diffstat (limited to 'spec/outputs/with.lua')
-rw-r--r--spec/outputs/with.lua176
1 files changed, 71 insertions, 105 deletions
diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua
index 304d26e..b2a1c3b 100644
--- a/spec/outputs/with.lua
+++ b/spec/outputs/with.lua
@@ -9,24 +9,20 @@ do
9 end 9 end
10end 10end
11do 11do
12 do 12 local _with_0 = leaf
13 local _with_0 = leaf 13 _with_0.world()
14 _with_0.world() 14 _with_0.world(1, 2, 3)
15 _with_0.world(1, 2, 3) 15 local g = _with_0.what.is.this
16 local g = _with_0.what.is.this 16 _with_0.hi(1, 2, 3)
17 _with_0.hi(1, 2, 3) 17 _with_0:hi(1, 2).world(2323)
18 _with_0:hi(1, 2).world(2323) 18 _with_0:hi("yeah", "man")
19 _with_0:hi("yeah", "man") 19 _with_0.world = 200
20 _with_0.world = 200
21 end
22end 20end
23do 21do
24 local zyzyzy 22 local zyzyzy
25 do 23 local _with_0 = something
26 local _with_0 = something 24 _with_0.set_state("hello world")
27 _with_0.set_state("hello world") 25 zyzyzy = _with_0
28 zyzyzy = _with_0
29 end
30end 26end
31do 27do
32 local x = 5 + (function() 28 local x = 5 + (function()
@@ -45,12 +41,10 @@ do
45 } 41 }
46end 42end
47do 43do
48 do 44 local _with_0 = foo
49 local _with_0 = foo 45 local _ = _with_0:prop("something").hello
50 local _ = _with_0:prop("something").hello 46 _with_0.prop:send(one)
51 _with_0.prop:send(one) 47 _with_0.prop:send(one)
52 _with_0.prop:send(one)
53 end
54end 48end
55do 49do
56 do 50 do
@@ -79,69 +73,49 @@ do
79 return a 73 return a
80 end)()) 74 end)())
81 local p 75 local p
82 do 76 local _with_0 = 1
83 local _with_0 = 1 77 hello().x, world().y = _with_0, 2
84 hello().x, world().y = _with_0, 2 78 print(a + b)
85 print(a + b) 79 p = _with_0
86 p = _with_0
87 end
88end 80end
89do 81do
90 local x = "hello" 82 local x = "hello"
91 x:upper() 83 x:upper()
92end 84end
93do 85do
94 do 86 local k = "jo"
95 local k = "jo" 87 print(k:upper())
96 print(k:upper())
97 end
98end 88end
99do 89do
100 do 90 local a, b, c = "", "", ""
101 local a, b, c = "", "", "" 91 print(a:upper())
102 print(a:upper())
103 end
104end 92end
105do 93do
106 local a = "bunk" 94 local a = "bunk"
107 do 95 local b, c
108 local b, c 96 a, b, c = "", "", ""
109 a, b, c = "", "", "" 97 print(a:upper())
110 print(a:upper())
111 end
112end 98end
113do 99do
114 do 100 local _with_0 = j
115 local _with_0 = j 101 print(_with_0:upper())
116 print(_with_0:upper())
117 end
118end 102end
119do 103do
120 do 104 local _with_0 = "jo"
121 local _with_0 = "jo" 105 k.j = _with_0
122 k.j = _with_0 106 print(_with_0:upper())
123 print(_with_0:upper())
124 end
125end 107end
126do 108do
127 do 109 local _with_0 = a
128 local _with_0 = a 110 print(_with_0.b)
129 print(_with_0.b) 111 local _with_1 = _with_0.c
130 do 112 print(_with_1.d)
131 local _with_1 = _with_0.c
132 print(_with_1.d)
133 end
134 end
135end 113end
136do 114do
137 do 115 local _with_0 = a
138 local _with_0 = a 116 local _with_1 = 2
139 do 117 _with_0.b = _with_1
140 local _with_1 = 2 118 print(_with_1.c)
141 _with_0.b = _with_1
142 print(_with_1.c)
143 end
144 end
145end 119end
146do 120do
147 local _ 121 local _
@@ -151,43 +125,37 @@ do
151 end 125 end
152end 126end
153do 127do
154 do 128 local _with_0 = tb
155 local _with_0 = tb 129 _with_0.x = item.field:func(123)
156 _with_0.x = item.field:func(123)
157 end
158end 130end
159do 131do
160 do 132 local _with_0 = dad
161 local _with_0 = dad 133 _with_0["if"]("yes")
162 _with_0["if"]("yes") 134 local y = _with_0["end"].of["function"]
163 local y = _with_0["end"].of["function"]
164 end
165end 135end
166do 136do
137 local _with_0 = tb
167 do 138 do
168 local _with_0 = tb 139 local _obj_0 = _with_0[2]
169 do 140 if _obj_0 ~= nil then
170 local _obj_0 = _with_0[2] 141 _with_0[1] = _obj_0:func()
171 if _obj_0 ~= nil then
172 _with_0[1] = _obj_0:func()
173 end
174 end
175 _with_0["%a-b-c%"] = 123
176 _with_0[ [[x y z]]] = _with_0[var]
177 print(_with_0[_with_0[3]])
178 do
179 local _with_1 = _with_0[4]
180 _with_1[1] = 1
181 end 142 end
182 _with_0[#_with_0 + 1] = "abc"
183 _with_0[#_with_0 + 1] = {
184 type = "hello",
185 {
186 name = "xyz",
187 value = 998
188 }
189 }
190 end 143 end
144 _with_0["%a-b-c%"] = 123
145 _with_0[ [[x y z]]] = _with_0[var]
146 print(_with_0[_with_0[3]])
147 do
148 local _with_1 = _with_0[4]
149 _with_1[1] = 1
150 end
151 _with_0[#_with_0 + 1] = "abc"
152 _with_0[#_with_0 + 1] = {
153 type = "hello",
154 {
155 name = "xyz",
156 value = 998
157 }
158 }
191end 159end
192do 160do
193 do 161 do
@@ -204,16 +172,14 @@ do
204 end 172 end
205end 173end
206do 174do
207 do 175 local mask = SolidRect({
208 local mask = SolidRect({ 176 width = w,
209 width = w, 177 height = h,
210 height = h, 178 color = 0x66000000
211 color = 0x66000000 179 })
212 }) 180 if mask ~= nil then
213 if mask ~= nil then 181 mask.touchEnabled = true
214 mask.touchEnabled = true 182 mask.swallowTouches = true
215 mask.swallowTouches = true
216 end
217 end 183 end
218end 184end
219return nil 185return nil