aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-05-24 10:42:43 +0800
committerLi Jin <dragon-fly@qq.com>2022-05-24 10:42:43 +0800
commit2c25f56ac8b47542dec1267416c9d0cf13ee61cf (patch)
tree7e451391e6f0d223db410c9022c1b2be8fddbd22
parent241f0c0d76c18419b9e99447773786147973a296 (diff)
downloadyuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.tar.gz
yuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.tar.bz2
yuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.zip
fix spec.
-rw-r--r--spec/inputs/metatable.yue2
-rw-r--r--spec/outputs/metatable.lua14
2 files changed, 9 insertions, 7 deletions
diff --git a/spec/inputs/metatable.yue b/spec/inputs/metatable.yue
index 100844c..ed68a17 100644
--- a/spec/inputs/metatable.yue
+++ b/spec/inputs/metatable.yue
@@ -4,7 +4,7 @@ c = key1: true, :add#, key2: true
4w = [name]#:123, ["new"]#:(val)=> {val} 4w = [name]#:123, ["new"]#:(val)=> {val}
5w.#["new"] w.#[name] 5w.#["new"] w.#[name]
6 6
7close _ = close#: -> print "out of scope" 7do close _ = close#: -> print "out of scope"
8 8
9d, e = a.close, a.close# 9d, e = a.close, a.close#
10 10
diff --git a/spec/outputs/metatable.lua b/spec/outputs/metatable.lua
index 16ae86c..935202c 100644
--- a/spec/outputs/metatable.lua
+++ b/spec/outputs/metatable.lua
@@ -25,11 +25,13 @@ local w = setmetatable({ }, {
25 end 25 end
26}) 26})
27getmetatable(w)["new"](getmetatable(w)[name]) 27getmetatable(w)["new"](getmetatable(w)[name])
28local _ <close> = setmetatable({ }, { 28do
29 __close = function() 29 local _ <close> = setmetatable({ }, {
30 return print("out of scope") 30 __close = function()
31 end 31 return print("out of scope")
32}) 32 end
33 })
34end
33local d, e = a.close, getmetatable(a).__close 35local d, e = a.close, getmetatable(a).__close
34local f = getmetatable(a):__close(1) 36local f = getmetatable(a):__close(1)
35getmetatable(a).__add = function(x, y) 37getmetatable(a).__add = function(x, y)
@@ -63,7 +65,7 @@ end
63setmetatable(a.b, { }) 65setmetatable(a.b, { })
64x.abc = 123 66x.abc = 123
65setmetatable(func(), mt) 67setmetatable(func(), mt)
66_ = extra 68local _ = extra
67setmetatable(b.c, mt) 69setmetatable(b.c, mt)
68a, d, e = 1, "abc" 70a, d, e = 1, "abc"
69local is_same = getmetatable(a).__index == getmetatable(a).__index 71local is_same = getmetatable(a).__index == getmetatable(a).__index