diff options
Diffstat (limited to 'server/src/core')
-rw-r--r-- | server/src/core/vm.lua | 11 |
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, } |