aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/assign.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-07-26 18:05:23 +0800
committerLi Jin <dragon-fly@qq.com>2022-07-26 18:05:23 +0800
commit0f5bdeaeba0f04e49c47f4a2be55b14185a7dfdd (patch)
treeb5baa6c385ce58c60615ff0577a1e2b6850f044d /spec/outputs/assign.lua
parente191defb6545509a4ae0b402f2fac1fbe18551cd (diff)
downloadyuescript-0f5bdeaeba0f04e49c47f4a2be55b14185a7dfdd.tar.gz
yuescript-0f5bdeaeba0f04e49c47f4a2be55b14185a7dfdd.tar.bz2
yuescript-0f5bdeaeba0f04e49c47f4a2be55b14185a7dfdd.zip
fix missing checks and issues related to destrucuring in if branches.
Diffstat (limited to 'spec/outputs/assign.lua')
-rw-r--r--spec/outputs/assign.lua93
1 files changed, 90 insertions, 3 deletions
diff --git a/spec/outputs/assign.lua b/spec/outputs/assign.lua
index 628f763..c7f2e20 100644
--- a/spec/outputs/assign.lua
+++ b/spec/outputs/assign.lua
@@ -7,14 +7,14 @@ _ = function()
7 local a, b, c 7 local a, b, c
8 a, b, c, d = 1, 2, 3, 4 8 a, b, c, d = 1, 2, 3, 4
9 local hello 9 local hello
10 hello[232], (5 + 5)[121], hello, x[99] = 100, 200, 300 10 hello[232], (5 + 5)[121], hello, x[99] = 100, 200, 300, 400
11 joop = 12 11 joop = 12
12 end 12 end
13end 13end
14local joop = 2345 14local joop = 2345
15local a, b 15local a, b
16if hello then 16if hello then
17 a, b = "hello" 17 a, b = "hello", nil
18else 18else
19 a, b = "nothing", "yeah" 19 a, b = "nothing", "yeah"
20end 20end
@@ -22,7 +22,7 @@ if hello then
22 if yeah then 22 if yeah then
23 a, b = "one", "two" 23 a, b = "one", "two"
24 else 24 else
25 a, b = "mmhh" 25 a, b = "mmhh", nil
26 end 26 end
27else 27else
28 print("the other") 28 print("the other")
@@ -42,3 +42,90 @@ do
42 end)()) 42 end)())
43 end 43 end
44end 44end
45return _(function()
46 setmetatable(a, (function()
47 print(123)
48 return { }
49 end)())
50 do
51 local a, b
52 if "a" == c then
53 do
54 local _obj_0 = tb
55 a, b = _obj_0[1], _obj_0[2]
56 end
57 elseif "b" == c then
58 do
59 local _obj_0 = f()
60 a, b = _obj_0[1], _obj_0[2]
61 end
62 end
63 end
64 if x then
65 a[#a + 1] = 1
66 else
67 a[#a + 1] = 2
68 end
69 do
70 local a
71 if x then
72 do
73 local _exp_0 = y
74 if 1 == _exp_0 then
75 do
76 local _obj_0, _obj_1 = f()
77 b[#b + 1] = _obj_1
78 a = _obj_0
79 end
80 end
81 end
82 end
83 end
84 do
85 local a
86 local b
87 if x then
88 do
89 local _obj_0, _obj_1 = f()
90 a = _obj_0
91 b = _obj_1[1]
92 end
93 else
94 a = 123
95 b = tb[1]
96 end
97 end
98 do
99 local a, c
100 if x then
101 do
102 local _exp_0 = y
103 if 1 == _exp_0 then
104 do
105 local _obj_0, _obj_1, _obj_2, _obj_3 = f()
106 b[#b + 1] = _obj_1
107 a, c, getmetatable(d).__add = _obj_0, _obj_2, _obj_3
108 end
109 end
110 end
111 elseif x2 then
112 if y2 then
113 do
114 local _obj_0, _obj_1, _obj_2, _obj_3 = f1()
115 b[#b + 1] = _obj_1
116 a, c, getmetatable(d).__add = _obj_0, _obj_2, _obj_3
117 end
118 end
119 else
120 print("hello")
121 do
122 print(123)
123 do
124 local _obj_0, _obj_1, _obj_2 = f2()
125 b[#b + 1] = _obj_0
126 a, c, getmetatable(d).__add = 1, _obj_1, _obj_2
127 end
128 end
129 end
130 end
131end)