summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-07 10:39:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-07 10:39:54 +0800
commit3c4b2f65e2d2cd39461211c640246cb04d9f53ad (patch)
tree315afe64a8c708c140b0332af8bf1d277730769a
parentde63af45054e742806f6f4cc78e2819b12c364e6 (diff)
downloadlua-language-server-3c4b2f65e2d2cd39461211c640246cb04d9f53ad.zip
改成直接覆盖吧
-rw-r--r--server/src/core/vm.lua4
-rw-r--r--server/src/parser/ast.lua1
-rw-r--r--server/test/document_symbol/init.lua10
-rw-r--r--server/test/vm/example.lua8
4 files changed, 21 insertions, 2 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua
index a17727d6..549fdc80 100644
--- a/server/src/core/vm.lua
+++ b/server/src/core/vm.lua
@@ -332,8 +332,10 @@ function mt:setValue(var, value, source)
if var.value then
if value.type == 'any' then
self:mergeChild(var.value, value)
- else
+ elseif value.type == 'nil' then
self:mergeValue(var.value, value)
+ elseif var.value.uri == self.uri then
+ var.value = value
end
value = var.value
else
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 993a4914..e807c46a 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -695,6 +695,7 @@ local defs = {
}
return function (self, lua, mode)
+
Errs = {}
local suc, res, err = pcall(self.grammar, lua, mode, defs)
if not suc then
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua
index 73e910cb..397893e6 100644
--- a/server/test/document_symbol/init.lua
+++ b/server/test/document_symbol/init.lua
@@ -319,3 +319,13 @@ local t = {
}
}
}
+
+-- 临时
+local fs = require 'bee.filesystem'
+local function testIfExit(path)
+ local buf = io.load(fs.path(path))
+ if buf then
+ TEST(buf)(EXISTS)
+ end
+end
+testIfExit[[D:\Github\lua\testes\coroutine.lua]]
diff --git a/server/test/vm/example.lua b/server/test/vm/example.lua
index 5775465b..459545fd 100644
--- a/server/test/vm/example.lua
+++ b/server/test/vm/example.lua
@@ -3,4 +3,10 @@ local fs = require 'bee.filesystem'
TEST(io.load(ROOT / 'src' / 'core' / 'vm.lua'))
-- 临时
-TEST(io.load(fs.path [[D:\Github\lua\testes\constructs.lua]]))
+local function testIfExit(path)
+ local buf = io.load(fs.path(path))
+ if buf then
+ TEST(buf)
+ end
+end
+testIfExit[[D:\Github\lua\testes\constructs.lua]]