From 2c25f56ac8b47542dec1267416c9d0cf13ee61cf Mon Sep 17 00:00:00 2001 From: Li Jin Date: Tue, 24 May 2022 10:42:43 +0800 Subject: fix spec. --- spec/inputs/metatable.yue | 2 +- 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 w = [name]#:123, ["new"]#:(val)=> {val} w.#["new"] w.#[name] -close _ = close#: -> print "out of scope" +do close _ = close#: -> print "out of scope" d, e = a.close, a.close# 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({ }, { end }) getmetatable(w)["new"](getmetatable(w)[name]) -local _ = setmetatable({ }, { - __close = function() - return print("out of scope") - end -}) +do + local _ = setmetatable({ }, { + __close = function() + return print("out of scope") + end + }) +end local d, e = a.close, getmetatable(a).__close local f = getmetatable(a):__close(1) getmetatable(a).__add = function(x, y) @@ -63,7 +65,7 @@ end setmetatable(a.b, { }) x.abc = 123 setmetatable(func(), mt) -_ = extra +local _ = extra setmetatable(b.c, mt) a, d, e = 1, "abc" local is_same = getmetatable(a).__index == getmetatable(a).__index -- cgit v1.2.3-55-g6feb