aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/existential.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
committerLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
commit60a979e224f26117f5be82bfca757a2483cef0fd (patch)
tree7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/existential.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/existential.lua')
-rw-r--r--spec/outputs/existential.lua156
1 files changed, 156 insertions, 0 deletions
diff --git a/spec/outputs/existential.lua b/spec/outputs/existential.lua
new file mode 100644
index 0000000..4a64c49
--- /dev/null
+++ b/spec/outputs/existential.lua
@@ -0,0 +1,156 @@
1if f1 ~= nil then
2 f1()
3end
4if f2 ~= nil then
5 f2("arg0", 123)
6end
7local x
8if tab ~= nil then
9 x = tab.value
10end
11print((function()
12 if abc ~= nil then
13 local _obj_0 = abc["hello world"]
14 if _obj_0 ~= nil then
15 return _obj_0.xyz
16 end
17 return nil
18 end
19 return nil
20end)())
21if print and (x ~= nil) then
22 print(x)
23end
24if self ~= nil then
25 self:func(998)
26end
27do
28 local _with_0
29 if abc ~= nil then
30 local _obj_0 = abc()
31 local _obj_1 = _obj_0.func
32 if _obj_1 ~= nil then
33 _with_0 = _obj_1(_obj_0)
34 end
35 end
36 if (function()
37 local _obj_0 = _with_0.p
38 if _obj_0 ~= nil then
39 return _obj_0(_with_0, "abc")
40 end
41 return nil
42 end)() then
43 return 123
44 end
45end
46do
47 local _des_0
48 if a ~= nil then
49 local _obj_0 = a["if"]
50 if _obj_0 ~= nil then
51 local _obj_1 = _obj_0["then"]
52 if _obj_1 ~= nil then
53 local _obj_2 = _obj_1(_obj_0, 123)
54 if _obj_2 ~= nil then
55 _des_0 = _obj_2((function()
56 if self ~= nil then
57 return self["function"](self, 998)
58 end
59 return nil
60 end)())
61 end
62 end
63 end
64 end
65 if _des_0 then
66 x = _des_0.x
67 print(x)
68 end
69end
70local res = ((function()
71 local _call_0 = b["function"]
72 local _obj_0 = _call_0["do"](_call_0)
73 local _obj_1 = _obj_0["while"]
74 if _obj_1 ~= nil then
75 local _call_1 = _obj_1(_obj_0, "OK")
76 local _base_0 = _call_1["if"](_call_1, "def", 998)
77 local _fn_0 = _base_0.f
78 return _fn_0 and function(...)
79 return _fn_0(_base_0, ...)
80 end
81 end
82 return nil
83end)() ~= nil)
84print(res)
85local solipsism
86if (mind ~= nil) and not (world ~= nil) then
87 solipsism = true
88end
89local speed = 0
90speed = speed or 15
91local footprints = yeti or "bear"
92local major = 'Computer Science'
93if not (major ~= nil) then
94 signUpForClass('Introduction to Wines')
95end
96if (window ~= nil) then
97 local environment = 'browser (probably)'
98end
99local zip
100local _obj_0 = lottery.drawWinner
101if _obj_0 ~= nil then
102 local _obj_1 = _obj_0().address
103 if _obj_1 ~= nil then
104 zip = _obj_1.zipcode
105 end
106end
107local len = (function()
108 if utf8 ~= nil then
109 return utf8.len
110 end
111 return nil
112end)() or (function()
113 if string ~= nil then
114 return string.len
115 end
116 return nil
117end)() or function(o)
118 return #o
119end
120local a
121if tb1 ~= nil then
122 local _obj_1 = tb1["end"]
123 if _obj_1 ~= nil then
124 a = _obj_1(tb1, 123 + (function()
125 if tb2 ~= nil then
126 return tb2["then"](tb2, 456)
127 end
128 return nil
129 end)())
130 end
131end
132local b = ((function()
133 if tb1 ~= nil then
134 local _base_0 = tb1
135 local _fn_0 = _base_0["end"]
136 return _fn_0 and function(...)
137 return _fn_0(_base_0, ...)
138 end
139 end
140 return nil
141end)() ~= nil) or (function()
142 if tb2 ~= nil then
143 local _base_0 = tb2
144 local _fn_0 = _base_0["then"]
145 return _fn_0 and function(...)
146 return _fn_0(_base_0, ...)
147 end
148 end
149 return nil
150end)()
151local _with_0 = io.open("test.txt", "w")
152if _with_0 ~= nil then
153 _with_0:write("hello")
154 _with_0:close()
155end
156return _with_0