diff options
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 28 | ||||
-rw-r--r-- | script/vm/generic.lua | 2 | ||||
-rw-r--r-- | script/vm/global.lua | 4 | ||||
-rw-r--r-- | script/vm/local-id.lua | 4 | ||||
-rw-r--r-- | script/vm/runner.lua | 16 |
5 files changed, 27 insertions, 27 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 1880122a..4a4486e9 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -9,12 +9,12 @@ local vm = require 'vm.vm' local LOCK = {} ---@class parser.object ----@field _compiledNodes boolean ----@field _node vm.node ----@field _globalBase table ----@field cindex integer ----@field func parser.object ----@field operators? parser.object[] +---@field _compiledNodes boolean +---@field _node vm.node +---@field public _globalBase table +---@field cindex integer +---@field func parser.object +---@field operators? parser.object[] -- 该函数有副作用,会给source绑定node! ---@param source parser.object @@ -115,7 +115,7 @@ end ---@param ref boolean ---@param pushResult fun(res: parser.object, markDoc?: boolean) local function searchFieldByGlobalID(suri, source, key, ref, pushResult) - local node = source._globalNode + local node = vm.getGlobalNode(source) if not node then return end @@ -398,8 +398,8 @@ function vm.getClassFields(suri, object, key, ref, pushResult) and field.value then if vm.getLocalID(field) and vm.getLocalID(field) == vm.getLocalID(field.value) then - elseif src._globalNode - and src._globalNode == field.value._globalNode then + elseif vm.getGlobalNode(src) + and vm.getGlobalNode(src) == vm.getGlobalNode(field.value) then else hasFounded[fieldKey] = true end @@ -448,7 +448,7 @@ function vm.getClassFields(suri, object, key, ref, pushResult) end ---@class parser.object ----@field _sign vm.sign|false +---@field public _sign vm.sign|false ---@param source parser.object ---@return vm.sign|false @@ -958,9 +958,9 @@ function vm.compileCallArg(arg, call, index) end ---@class parser.object ----@field _iterator? table ----@field _iterArgs? table ----@field _iterVars? table<parser.object, vm.node> +---@field public _iterator? table +---@field public _iterArgs? table +---@field public _iterVars? table<parser.object, vm.node> ---@param source parser.object ---@param target parser.object @@ -1762,7 +1762,7 @@ end ---@param source parser.object local function compileByGlobal(source) - local global = source._globalNode + local global = vm.getGlobalNode(source) if not global then return end diff --git a/script/vm/generic.lua b/script/vm/generic.lua index 544e11c9..78df7caf 100644 --- a/script/vm/generic.lua +++ b/script/vm/generic.lua @@ -2,7 +2,7 @@ local vm = require 'vm.vm' ---@class parser.object ----@field _generic vm.generic +---@field public _generic vm.generic ---@class vm.generic ---@field sign vm.sign diff --git a/script/vm/global.lua b/script/vm/global.lua index 93316901..86fd78cc 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -165,8 +165,8 @@ local function createGlobal(name, cate) end ---@class parser.object ----@field _globalNode vm.global|false ----@field _enums? (string|integer)[] +---@field public _globalNode vm.global|false +---@field public _enums? (string|integer)[] ---@type table<string, vm.global> local allGlobals = {} diff --git a/script/vm/local-id.lua b/script/vm/local-id.lua index 9168d680..75ac7f8d 100644 --- a/script/vm/local-id.lua +++ b/script/vm/local-id.lua @@ -4,8 +4,8 @@ local guide = require 'parser.guide' local vm = require 'vm.vm' ---@class parser.object ----@field _localID string|false ----@field _localIDs table<string, { sets: parser.object[], gets: parser.object[] }> +---@field public _localID string|false +---@field public _localIDs table<string, { sets: parser.object[], gets: parser.object[] }> local compileLocalID, getLocal diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 2f047983..7363f0e5 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -44,7 +44,7 @@ function mt:_markHas(obj) end end -function mt:_collect() +function mt:collect() local startPos = self._loc.start local finishPos = 0 @@ -128,7 +128,7 @@ function mt:_lookIntoChild(action, topNode, outNode) end end elseif action.type == 'function' then - self:_lookIntoBlock(action, topNode:copy()) + self:lookIntoBlock(action, topNode:copy()) elseif action.type == 'unary' then if not action[1] then goto RETURN @@ -233,7 +233,7 @@ function mt:_lookIntoChild(action, topNode, outNode) or action.type == 'in' or action.type == 'repeat' or action.type == 'for' then - topNode = self:_lookIntoBlock(action, topNode:copy()) + topNode = self:lookIntoBlock(action, topNode:copy()) elseif action.type == 'while' then local blockNode, mainNode if action.filter then @@ -242,7 +242,7 @@ function mt:_lookIntoChild(action, topNode, outNode) blockNode = topNode:copy() mainNode = topNode:copy() end - blockNode = self:_lookIntoBlock(action, blockNode:copy()) + blockNode = self:lookIntoBlock(action, blockNode:copy()) topNode = mainNode:merge(blockNode) if action.filter then -- look into filter again @@ -263,7 +263,7 @@ function mt:_lookIntoChild(action, topNode, outNode) hasElse = true mainNode:clear() end - blockNode = self:_lookIntoBlock(subBlock, blockNode:copy()) + blockNode = self:lookIntoBlock(subBlock, blockNode:copy()) local neverReturn = subBlock.hasReturn or subBlock.hasGoTo or subBlock.hasBreak @@ -326,7 +326,7 @@ end ---@param block parser.object ---@param topNode vm.node ---@return vm.node topNode -function mt:_lookIntoBlock(block, topNode) +function mt:lookIntoBlock(block, topNode) if not self._has[block] then return topNode end @@ -355,7 +355,7 @@ function vm.launchRunner(loc, callback) _callback = callback, }, mt) - self:_collect() + self:collect() - self:_lookIntoBlock(main, vm.getNode(loc):copy()) + self:lookIntoBlock(main, vm.getNode(loc):copy()) end |