diff options
-rw-r--r-- | script-beta/core/completion.lua | 4 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 12 |
2 files changed, 6 insertions, 10 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 658e3da2..2837eb68 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -303,8 +303,8 @@ local function checkFieldFromFieldToIndex(name, parent, word, start, offset) } end else - if config.runtime.version == 'Lua 5.1' - or config.runtime.version == 'LuaJIT' then + if config.config.runtime.version == 'Lua 5.1' + or config.config.runtime.version == 'LuaJIT' then textEdit.newText = '_G' .. textEdit.newText else textEdit.newText = '_ENV' .. textEdit.newText diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index f066d925..da2dc6e5 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -219,8 +219,11 @@ function m.getUri(obj) end function m.getENV(source, start) + if not start then + start = 1 + end return m.getLocal(source, '_ENV', start) - or m.getLabel(source, '@env', start) + or m.getLocal(source, '@env', start) end --- 寻找函数的不定参数,返回不定参在第几个参数上,以及该参数对象。 @@ -632,13 +635,6 @@ function m.getSimpleName(obj) return m.getKeyName(obj) end -function m.getENV(ast) - if ast.type ~= 'main' then - return nil - end - return ast.locals and ast.locals[1] -end - --- 测试 a 到 b 的路径(不经过函数,不考虑 goto), --- 每个路径是一个 block 。 --- |