Skip to content

Commit fd43361

Browse files
committed
fix infer of global sets
1 parent 4a284d1 commit fd43361

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

script/vm/compiler.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ local function bindAs(source)
530530
return false
531531
end
532532

533+
-- 该函数有副作用,会给source绑定node!
533534
local function bindDocs(source)
534535
local isParam = source.parent.type == 'funcargs'
535536
or source.parent.type == 'in'
@@ -565,12 +566,12 @@ local function bindDocs(source)
565566
local name = doc.module
566567
local uri = rpath.findUrisByRequirePath(guide.getUri(source), name)[1]
567568
if not uri then
568-
return nil
569+
return true
569570
end
570571
local state = files.getState(uri)
571572
local ast = state and state.ast
572573
if not ast then
573-
return nil
574+
return true
574575
end
575576
vm.setNode(source, vm.compileNode(ast))
576577
return true
@@ -1815,6 +1816,7 @@ local function compileByGlobal(source)
18151816
end
18161817
end
18171818
end
1819+
vm.setNode(set, globalNode)
18181820
end
18191821
end
18201822
if global.cate == 'type' then

0 commit comments

Comments
 (0)