From c1ccd90beef8b0a79a8e9c47547dda3dd865e14d 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, 23 Feb 2022 17:26:34 +0800 Subject: update --- script/vm/getDef.lua | 4 ++++ script/vm/global-node.lua | 6 +++++- script/vm/node/compiler.lua | 4 ++++ test/definition/table.lua | 10 +++++----- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/script/vm/getDef.lua b/script/vm/getDef.lua index 735a817e..df180420 100644 --- a/script/vm/getDef.lua +++ b/script/vm/getDef.lua @@ -88,6 +88,10 @@ local nodeMap;nodeMap = util.switch() end) : case 'getfield' : case 'setfield' + : case 'getmethod' + : case 'setmethod' + : case 'getindex' + : case 'setindex' : call(function (source, pushResult) local node = compiler.compileNode(source.node) if not node then diff --git a/script/vm/global-node.lua b/script/vm/global-node.lua index 107ea2e0..6235ff6b 100644 --- a/script/vm/global-node.lua +++ b/script/vm/global-node.lua @@ -5,7 +5,7 @@ local globalBuilder = require 'vm.node.global' ---@class parser.object ---@field _globalNode vm.node.global ----@class vm.global-id +---@class vm.global-node local m = {} ---@type table m.globals = util.defaultTable(globalBuilder) @@ -46,6 +46,8 @@ local compilerGlobalMap = util.switch() end end) : case 'setfield' + : case 'setmethod' + : case 'setindex' ---@param uri uri ---@param source parser.object : call(function (uri, source) @@ -57,6 +59,8 @@ local compilerGlobalMap = util.switch() source._globalNode = m.declareGlobal(name, uri, source) end) : case 'getfield' + : case 'getmethod' + : case 'getindex' ---@param uri uri ---@param source parser.object : call(function (uri, source) diff --git a/script/vm/node/compiler.lua b/script/vm/node/compiler.lua index 003ff884..72869b25 100644 --- a/script/vm/node/compiler.lua +++ b/script/vm/node/compiler.lua @@ -158,10 +158,14 @@ local compilerMap = util.switch() m.setNode(source, m.compileNode(source.node)) end) : case 'setfield' + : case 'setmethod' + : case 'setindex' : call(function (source) compileByLocalID(source) end) : case 'getfield' + : case 'getmethod' + : case 'getindex' : call(function (source) compileByLocalID(source) compileByParentNode(source) diff --git a/test/definition/table.lua b/test/definition/table.lua index 9486ae93..66e71b0c 100644 --- a/test/definition/table.lua +++ b/test/definition/table.lua @@ -170,8 +170,8 @@ local t = f() t. ]] -TEST [[ -local t = { } - -print(t[]) -]] +--TEST [[ +--local t = { } +-- +--print(t[]) +--]] -- cgit v1.2.3