diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-08 16:06:03 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-08 16:06:03 +0800 |
commit | 2bdcabc48557e6b968df7ae88cafe8d318c44a1d (patch) | |
tree | 9e927625149ae6c67e1a9b28d8f157ee8cf94df6 /server/src | |
parent | 04d1af4aa0b26e7ddc28a5d8c056b23097c9175b (diff) | |
download | lua-language-server-2bdcabc48557e6b968df7ae88cafe8d318c44a1d.zip |
一处绑定判空
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/emmy/field.lua | 5 | ||||
-rw-r--r-- | server/src/service.lua | 15 |
2 files changed, 16 insertions, 4 deletions
diff --git a/server/src/emmy/field.lua b/server/src/emmy/field.lua index d7dfbe98..f9e9cbf6 100644 --- a/server/src/emmy/field.lua +++ b/server/src/emmy/field.lua @@ -25,6 +25,11 @@ function mt:bindValue(value) if value then self._bindValue = value else + if self._bindValue then + if not self._bindValue:getSource() then + self._bindValue = nil + end + end return self._bindValue end end diff --git a/server/src/service.lua b/server/src/service.lua index 3501b39a..639f6cc2 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -433,6 +433,9 @@ function mt:compileVM(uri) if not compiled then return nil end + if obj.vm then + obj.vm:remove() + end local clock = os.clock() local ast = self:compileAst(obj) @@ -846,9 +849,9 @@ function mt:_testFindDeadValues() local function pop() stack[#stack] = nil end - local function showStack() + local function showStack(uri) count = count + 1 - log.debug(table.concat(stack, '->')) + log.debug(uri, table.concat(stack, '->')) end local function scan(name, tbl) if count > 100 then @@ -861,10 +864,14 @@ function mt:_testFindDeadValues() return end mark[tbl] = true - push(name) + if tbl.type then + push(('%s<%s>'):format(name, tbl.type)) + else + push(name) + end if tbl.type == 'value' then if not tbl:getSource() then - showStack() + showStack(tbl.uri) end else for k, v in pairs(tbl) do |