diff options
-rw-r--r-- | script/parser/guide.lua | 2 | ||||
-rw-r--r-- | script/vm/compiler.lua | 25 |
2 files changed, 21 insertions, 6 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index c0f33c28..884a5271 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -966,8 +966,6 @@ function m.getKeyName(obj) return obj[1] elseif tp == 'doc.type.field' then return obj.name[1] - elseif tp == 'dummy' then - return obj[1] end return m.getKeyNameOfLiteral(obj) end diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 7b6531aa..69b1ac25 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -246,9 +246,18 @@ function vm.getClassFields(suri, node, key, pushResult) local function searchGlobal(class) if class.cate == 'type' and class.name == '_G' then - local sets = globalMgr.getGlobalSets(suri, 'variable') - for _, set in ipairs(sets) do - pushResult(set) + if key == nil then + local sets = globalMgr.getGlobalSets(suri, 'variable') + for _, set in ipairs(sets) do + pushResult(set) + end + else + local global = globalMgr.getGlobal('variable', key) + if global then + for _, set in ipairs(global:getSets(suri)) do + pushResult(set) + end + end end end end @@ -1599,7 +1608,15 @@ local function compileByGlobal(source) end globalNode = vm.createNode(global) vm.setNode(root._globalBase[name], globalNode, true) - vm.setNode(source, globalNode, true) + + local sets = global.links[uri].sets or {} + local gets = global.links[uri].gets or {} + for _, set in ipairs(sets) do + vm.setNode(set, globalNode, true) + end + for _, get in ipairs(gets) do + vm.setNode(get, globalNode, true) + end if global.cate == 'variable' then local hasMarkDoc |