diff options
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/diagnostics/undefined-global.lua | 2 | ||||
-rw-r--r-- | script-beta/vm/getGlobals.lua | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/script-beta/core/diagnostics/undefined-global.lua b/script-beta/core/diagnostics/undefined-global.lua index 3a9aa554..6b78225c 100644 --- a/script-beta/core/diagnostics/undefined-global.lua +++ b/script-beta/core/diagnostics/undefined-global.lua @@ -19,7 +19,7 @@ return function (uri, callback) return end if globalCache[key] == nil then - local defs = guide.requestDefinition(src) + local defs = vm.getDefs(src) -- 这里要处理跨文件的情况 globalCache[key] = #defs > 0 end diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua index adc6c9fc..53fff173 100644 --- a/script-beta/vm/getGlobals.lua +++ b/script-beta/vm/getGlobals.lua @@ -12,10 +12,12 @@ local function getGlobalsOfFile(uri) local results = guide.requestFields(env) for _, res in ipairs(results) do local name = guide.getSimpleName(res) - if not globals[name] then - globals[name] = {} + if name then + if not globals[name] then + globals[name] = {} + end + globals[name][#globals[name]+1] = res end - globals[name][#globals[name]+1] = res end return globals end |