diff options
author | Li Jin <dragon-fly@qq.com> | 2022-02-08 16:39:20 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-02-08 16:39:20 +0800 |
commit | a6744ed09b49b740dfc2852d655f5ed6dd471cbf (patch) | |
tree | 4209b5f16c67f79259ad4c6bf116a8428b589ad3 /spec/outputs | |
parent | d22ae154b57ac80107020e98f04f76fffaa9cd90 (diff) | |
download | yuescript-a6744ed09b49b740dfc2852d655f5ed6dd471cbf.tar.gz yuescript-a6744ed09b49b740dfc2852d655f5ed6dd471cbf.tar.bz2 yuescript-a6744ed09b49b740dfc2852d655f5ed6dd471cbf.zip |
fix a case combining the use of existential op and metatable op. raise error when use existential op in the left part in an assignment.
Diffstat (limited to 'spec/outputs')
-rw-r--r-- | spec/outputs/existential.lua | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/spec/outputs/existential.lua b/spec/outputs/existential.lua index 4a64c49..b594218 100644 --- a/spec/outputs/existential.lua +++ b/spec/outputs/existential.lua | |||
@@ -148,9 +148,27 @@ end)() ~= nil) or (function() | |||
148 | end | 148 | end |
149 | return nil | 149 | return nil |
150 | end)() | 150 | end)() |
151 | local _with_0 = io.open("test.txt", "w") | 151 | do |
152 | if _with_0 ~= nil then | 152 | local _with_0 = io.open("test.txt", "w") |
153 | _with_0:write("hello") | 153 | if _with_0 ~= nil then |
154 | _with_0:close() | 154 | _with_0:write("hello") |
155 | _with_0:close() | ||
156 | end | ||
157 | end | ||
158 | if tb ~= nil then | ||
159 | local _obj_1 = getmetatable(tb).__a | ||
160 | if _obj_1 ~= nil then | ||
161 | _obj_1(123) | ||
162 | end | ||
163 | end | ||
164 | do | ||
165 | local _with_0 | ||
166 | local _obj_1 = getmetatable(tb) | ||
167 | if _obj_1 ~= nil then | ||
168 | _with_0 = getmetatable(_obj_1).__index | ||
169 | end | ||
170 | if _with_0 ~= nil then | ||
171 | _with_0.a = 1 | ||
172 | end | ||
155 | end | 173 | end |
156 | return _with_0 | 174 | return nil |