summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]]