diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/noder.lua | 12 | ||||
-rw-r--r-- | script/parser/guide.lua | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md index e1f64cd5..f5ff9ebc 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 2.3.6 * `FIX` completion: can not find global fields +* `FIX` globals and class may lost ## 2.3.5 `2021-8-9` diff --git a/script/core/noder.lua b/script/core/noder.lua index 318020d0..a9aa153a 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1405,6 +1405,10 @@ function m.compileAllNodes(source) return noders end root._initedNoders = true + if not root._compiledGlobals then + collector.dropUri(guide.getUri(root)) + end + root._compiledGlobals = true log.debug('compileNodes:', guide.getUri(root)) guide.eachSource(root, function (src) m.compileNode(noders, src) @@ -1511,6 +1515,13 @@ end ---@param root parser.guide.object ---@return table function m.compileGlobalNodes(root) + if root._initedNoders then + return + end + if not root._compiledGlobals then + collector.dropUri(guide.getUri(root)) + end + root._compiledGlobals = true local noders = m.getNoders(root) local env = guide.getENV(root) @@ -1530,7 +1541,6 @@ end files.watch(function (ev, uri) uri = files.asKey(uri) if ev == 'update' then - collector.dropUri(uri) local state = files.getState(uri) if state then --m.compileAllNodes(state.ast) diff --git a/script/parser/guide.lua b/script/parser/guide.lua index acf996b7..71360b38 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -58,6 +58,8 @@ local type = type ---@field _noders noders ---@field _mnode parser.guide.object ---@field _noded boolean +---@field _initedNoders boolean +---@field _compiledGlobals boolean ---@class guide ---@field debugMode boolean |