diff options
author | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
commit | 60a979e224f26117f5be82bfca757a2483cef0fd (patch) | |
tree | 7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/existential.lua | |
parent | a19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff) | |
download | yuescript-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.lua | 156 |
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 @@ | |||
1 | if f1 ~= nil then | ||
2 | f1() | ||
3 | end | ||
4 | if f2 ~= nil then | ||
5 | f2("arg0", 123) | ||
6 | end | ||
7 | local x | ||
8 | if tab ~= nil then | ||
9 | x = tab.value | ||
10 | end | ||
11 | print((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 | ||
20 | end)()) | ||
21 | if print and (x ~= nil) then | ||
22 | print(x) | ||
23 | end | ||
24 | if self ~= nil then | ||
25 | self:func(998) | ||
26 | end | ||
27 | do | ||
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 | ||
45 | end | ||
46 | do | ||
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 | ||
69 | end | ||
70 | local 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 | ||
83 | end)() ~= nil) | ||
84 | print(res) | ||
85 | local solipsism | ||
86 | if (mind ~= nil) and not (world ~= nil) then | ||
87 | solipsism = true | ||
88 | end | ||
89 | local speed = 0 | ||
90 | speed = speed or 15 | ||
91 | local footprints = yeti or "bear" | ||
92 | local major = 'Computer Science' | ||
93 | if not (major ~= nil) then | ||
94 | signUpForClass('Introduction to Wines') | ||
95 | end | ||
96 | if (window ~= nil) then | ||
97 | local environment = 'browser (probably)' | ||
98 | end | ||
99 | local zip | ||
100 | local _obj_0 = lottery.drawWinner | ||
101 | if _obj_0 ~= nil then | ||
102 | local _obj_1 = _obj_0().address | ||
103 | if _obj_1 ~= nil then | ||
104 | zip = _obj_1.zipcode | ||
105 | end | ||
106 | end | ||
107 | local len = (function() | ||
108 | if utf8 ~= nil then | ||
109 | return utf8.len | ||
110 | end | ||
111 | return nil | ||
112 | end)() or (function() | ||
113 | if string ~= nil then | ||
114 | return string.len | ||
115 | end | ||
116 | return nil | ||
117 | end)() or function(o) | ||
118 | return #o | ||
119 | end | ||
120 | local a | ||
121 | if 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 | ||
131 | end | ||
132 | local 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 | ||
141 | end)() ~= 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 | ||
150 | end)() | ||
151 | local _with_0 = io.open("test.txt", "w") | ||
152 | if _with_0 ~= nil then | ||
153 | _with_0:write("hello") | ||
154 | _with_0:close() | ||
155 | end | ||
156 | return _with_0 | ||