diff options
author | Li Jin <dragon-fly@qq.com> | 2022-05-24 10:42:43 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-05-24 10:42:43 +0800 |
commit | 2c25f56ac8b47542dec1267416c9d0cf13ee61cf (patch) | |
tree | 7e451391e6f0d223db410c9022c1b2be8fddbd22 | |
parent | 241f0c0d76c18419b9e99447773786147973a296 (diff) | |
download | yuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.tar.gz yuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.tar.bz2 yuescript-2c25f56ac8b47542dec1267416c9d0cf13ee61cf.zip |
fix spec.
-rw-r--r-- | spec/inputs/metatable.yue | 2 | ||||
-rw-r--r-- | spec/outputs/metatable.lua | 14 |
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 | |||
4 | w = [name]#:123, ["new"]#:(val)=> {val} | 4 | w = [name]#:123, ["new"]#:(val)=> {val} |
5 | w.#["new"] w.#[name] | 5 | w.#["new"] w.#[name] |
6 | 6 | ||
7 | close _ = close#: -> print "out of scope" | 7 | do close _ = close#: -> print "out of scope" |
8 | 8 | ||
9 | d, e = a.close, a.close# | 9 | d, 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 | }) |
27 | getmetatable(w)["new"](getmetatable(w)[name]) | 27 | getmetatable(w)["new"](getmetatable(w)[name]) |
28 | local _ <close> = setmetatable({ }, { | 28 | do |
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 | }) | ||
34 | end | ||
33 | local d, e = a.close, getmetatable(a).__close | 35 | local d, e = a.close, getmetatable(a).__close |
34 | local f = getmetatable(a):__close(1) | 36 | local f = getmetatable(a):__close(1) |
35 | getmetatable(a).__add = function(x, y) | 37 | getmetatable(a).__add = function(x, y) |
@@ -63,7 +65,7 @@ end | |||
63 | setmetatable(a.b, { }) | 65 | setmetatable(a.b, { }) |
64 | x.abc = 123 | 66 | x.abc = 123 |
65 | setmetatable(func(), mt) | 67 | setmetatable(func(), mt) |
66 | _ = extra | 68 | local _ = extra |
67 | setmetatable(b.c, mt) | 69 | setmetatable(b.c, mt) |
68 | a, d, e = 1, "abc" | 70 | a, d, e = 1, "abc" |
69 | local is_same = getmetatable(a).__index == getmetatable(a).__index | 71 | local is_same = getmetatable(a).__index == getmetatable(a).__index |