diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-14 22:23:32 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-14 22:23:32 +0800 |
commit | 75509a89ecc69c683c015a97c9844746c81e6057 (patch) | |
tree | 9d2b0784a10fbda18784c3e939b6b65987569ff3 /script/vm | |
parent | 7df9f807faf27e3faea33842ed599963e00cdb0b (diff) | |
download | lua-language-server-75509a89ecc69c683c015a97c9844746c81e6057.zip |
cheanup
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 4 | ||||
-rw-r--r-- | script/vm/def.lua | 17 | ||||
-rw-r--r-- | script/vm/local-id.lua | 1 | ||||
-rw-r--r-- | script/vm/ref.lua | 2 |
4 files changed, 17 insertions, 7 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 531a0cd2..1d79cc1b 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -60,6 +60,7 @@ local searchFieldSwitch = util.switch() end end) : case 'local' + : case 'self' : call(function (suri, node, key, pushResult) local fields if key then @@ -716,7 +717,7 @@ local function compileLocalBase(source) hasMarkDoc = bindDocs(source) end local hasMarkParam - if source.dummy and not hasMarkDoc then + if source.type == 'self' and not hasMarkDoc then hasMarkParam = true vm.setNode(source, vm.compileNode(source.method.node)) end @@ -834,6 +835,7 @@ local compilerSwitch = util.switch() end end) : case 'local' + : case 'self' : call(function (source) local baseNode = compileLocalBase(source) vm.setNode(source, baseNode, true) diff --git a/script/vm/def.lua b/script/vm/def.lua index 78055ddf..40eb7b90 100644 --- a/script/vm/def.lua +++ b/script/vm/def.lua @@ -30,12 +30,19 @@ simpleSwitch = util.switch() end end end - - if source.dummy then - for _, res in ipairs(vm.getDefs(source.method.node)) do - pushResult(res) + end) + : case 'sellf' + : call(function (source, pushResult) + if source.ref then + for _, ref in ipairs(source.ref) do + if ref.type == 'setlocal' then + pushResult(ref) + end end end + for _, res in ipairs(vm.getDefs(source.method.node)) do + pushResult(res) + end end) : case 'getlocal' : case 'setlocal' @@ -209,7 +216,7 @@ function vm.getDefs(source) local hasLocal local function pushResult(src) - if src.type == 'local' and not src.dummy then + if src.type == 'local' then if hasLocal then return end diff --git a/script/vm/local-id.lua b/script/vm/local-id.lua index b7a6e6d5..cda49d23 100644 --- a/script/vm/local-id.lua +++ b/script/vm/local-id.lua @@ -12,6 +12,7 @@ m.ID_SPLITE = '\x1F' local compileSwitch = util.switch() : case 'local' + : case 'self' : call(function (source) source._localID = ('%d'):format(source.start) if not source.ref then diff --git a/script/vm/ref.lua b/script/vm/ref.lua index b086f6e1..65e8fdab 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -298,7 +298,7 @@ function vm.getRefs(source, fileNotify) local hasLocal local function pushResult(src) - if src.type == 'local' and not src.dummy then + if src.type == 'local' then if hasLocal then return end |