From 10c6e1cab7d727a94617ded2adbc5bf3e57824b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jan 2019 09:44:55 +0800 Subject: =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=8B=AC=E7=AB=8B=E7=9A=84DefaultSou?= =?UTF-8?q?rce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/vm.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'server/src/core/vm.lua') 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, } -- cgit v1.2.3