summaryrefslogtreecommitdiff
path: root/server/src/core/vm.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-30 09:44:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-30 09:44:55 +0800
commit10c6e1cab7d727a94617ded2adbc5bf3e57824b2 (patch)
tree2edeb0909719e980fba8837c7d21a03329f11fe4 /server/src/core/vm.lua
parent4f0379c5cadd79df2e5bc593198b5464aeeb982e (diff)
downloadlua-language-server-10c6e1cab7d727a94617ded2adbc5bf3e57824b2.zip
使用独立的DefaultSource
Diffstat (limited to 'server/src/core/vm.lua')
-rw-r--r--server/src/core/vm.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua
index 0a2a773c..6d941747 100644
--- a/server/src/core/vm.lua
+++ b/server/src/core/vm.lua
@@ -2,10 +2,13 @@ local env = require 'core.env'
local library = require 'core.library'
local createValue = require 'core.value'
-local DefaultSource = { start = 0, finish = 0 }
local LibraryValue = {}
local LibraryChild = {}
+local function getDefaultSource()
+ return { start = 0, finish = 0 }
+end
+
-- 根据赋值顺序决定遍历顺序的表
local function orderTable()
local t = {}
@@ -108,7 +111,7 @@ function mt:createLocal(key, source, value)
local loc = {
type = 'local',
key = key,
- source = source or DefaultSource,
+ source = source or getDefaultSource(),
close = self.scope.block.finish,
}
@@ -201,7 +204,7 @@ function mt:addInfo(var, type, source, value)
end
local info = {
type = type,
- source = source or DefaultSource,
+ source = source or getDefaultSource(),
value = value,
}
if not self.results.infos[var] then
@@ -226,7 +229,7 @@ end
function mt:createDots(index, source)
local dots = {
type = 'dots',
- source = source or DefaultSource,
+ source = source or getDefaultSource(),
func = self:getCurrentFunction(),
index = index,
}