From f57367d3bcdc7229d1d9b3125f6fd4c60342ca50 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, 22 Sep 2021 19:34:29 +0800 Subject: fix --- script/core/diagnostics/undefined-global.lua | 2 ++ script/core/noder.lua | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'script/core') diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua index c7ddeac2..14754c16 100644 --- a/script/core/diagnostics/undefined-global.lua +++ b/script/core/diagnostics/undefined-global.lua @@ -5,6 +5,7 @@ local config = require 'config' local guide = require 'parser.guide' local noder = require 'core.noder' local collector = require 'core.collector' +local await = require 'await' local requireLike = { ['include'] = true, @@ -35,6 +36,7 @@ return function (uri, callback) if node.tag ~= '_ENV' then return end + await.delay() local id = 'def:' .. noder.getID(src) if not collector.has(id) then local message = lang.script('DIAG_UNDEF_GLOBAL', key) diff --git a/script/core/noder.lua b/script/core/noder.lua index d6069833..1107dcda 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1583,11 +1583,6 @@ local partNodersMap = util.switch() m.compilePartNodes(noders, ref) end end - - local nxt = source.next - if nxt then - m.compilePartNodes(noders, nxt) - end end) : case 'setlocal' : case 'getlocal' @@ -1603,6 +1598,14 @@ local partNodersMap = util.switch() if parent.value == source then m.compilePartNodes(noders, parent) end + + if parent.type == 'call' then + local node = parent.node + if node.special == 'rawset' + or node.special == 'rawget' then + m.compilePartNodes(noders, parent) + end + end end) : case 'setfield' : case 'getfield' @@ -1634,6 +1637,14 @@ local partNodersMap = util.switch() if parent.value == source then m.compilePartNodes(noders, parent) end + + if parent.type == 'call' then + local node = parent.node + if node.special == 'rawset' + or node.special == 'rawget' then + m.compilePartNodes(noders, parent) + end + end end) : case 'label' : call(function (noders, source) -- cgit v1.2.3