@@ -246,9 +246,18 @@ function vm.getClassFields(suri, node, key, pushResult)
246246
247247 local function searchGlobal (class )
248248 if class .cate == ' type' and class .name == ' _G' then
249- local sets = globalMgr .getGlobalSets (suri , ' variable' )
250- for _ , set in ipairs (sets ) do
251- pushResult (set )
249+ if key == nil then
250+ local sets = globalMgr .getGlobalSets (suri , ' variable' )
251+ for _ , set in ipairs (sets ) do
252+ pushResult (set )
253+ end
254+ else
255+ local global = globalMgr .getGlobal (' variable' , key )
256+ if global then
257+ for _ , set in ipairs (global :getSets (suri )) do
258+ pushResult (set )
259+ end
260+ end
252261 end
253262 end
254263 end
@@ -1599,7 +1608,15 @@ local function compileByGlobal(source)
15991608 end
16001609 globalNode = vm .createNode (global )
16011610 vm .setNode (root ._globalBase [name ], globalNode , true )
1602- vm .setNode (source , globalNode , true )
1611+
1612+ local sets = global .links [uri ].sets or {}
1613+ local gets = global .links [uri ].gets or {}
1614+ for _ , set in ipairs (sets ) do
1615+ vm .setNode (set , globalNode , true )
1616+ end
1617+ for _ , get in ipairs (gets ) do
1618+ vm .setNode (get , globalNode , true )
1619+ end
16031620
16041621 if global .cate == ' variable' then
16051622 local hasMarkDoc
0 commit comments