diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 18:30:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 18:30:56 +0800 |
commit | 0c6436f78d48c6b4d6494ad9c3d573b6aa7baf06 (patch) | |
tree | ad58b44118c6c531a2d849f68c3b4157b04e099c /server/test | |
parent | 56303121277f5ebf9668ca9f3fc886392df83a16 (diff) | |
download | lua-language-server-0c6436f78d48c6b4d6494ad9c3d573b6aa7baf06.zip |
可以穿透大部分meta表了
Diffstat (limited to 'server/test')
-rw-r--r-- | server/test/definition/method.lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/server/test/definition/method.lua b/server/test/definition/method.lua index 2829f5b7..24e3b3b8 100644 --- a/server/test/definition/method.lua +++ b/server/test/definition/method.lua @@ -39,3 +39,51 @@ end local obj = setmetatable({}, mt) obj:<?method1?>() ]] + +TEST [[ +local mt +mt.__index = mt +function mt:<!method1!>() +end + +local obj = setmetatable(1, mt) +obj:<?method1?>() +]] + +TEST [[ +local mt +function mt:<!method1!>() +end + +local obj = setmetatable(1, { __index = mt }) +obj:<?method1?>() +]] + +TEST [[ +local mt +local api +function mt:<!method1!>() +end + +setmetatable(api, { __index = mt }) +api:<?method1?>() +]] + +TEST [[ +local mt +function mt:x() + self.<?init?>() +end + +local obj = setmetatable({}, { __index = mt }) +obj.<!init!> = 1 +]] + +TEST [[ +local mt +function mt:x() + self.<?init?>() +end + +local obj = setmetatable({ <!init!> = 1 }, { __index = mt }) +]] |