diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 16:57:53 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 16:57:53 +0800 |
commit | 0cf988c135cb2a94cda80cfbca187a3b58b2eee6 (patch) | |
tree | 65591516028c622ccabe028b74a383f1765796f9 /script | |
parent | 143424062920433c7e3994248dfc5d935c337de0 (diff) | |
download | lua-language-server-0cf988c135cb2a94cda80cfbca187a3b58b2eee6.zip |
#306
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/undefined-field.lua | 4 | ||||
-rw-r--r-- | script/parser/guide.lua | 2 | ||||
-rw-r--r-- | script/vm/guideInterface.lua | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua index a8fadfed..c5c64b4d 100644 --- a/script/core/diagnostics/undefined-field.lua +++ b/script/core/diagnostics/undefined-field.lua @@ -90,13 +90,13 @@ return function (uri, callback) if not fields[fieldName] then local message = lang.script('DIAG_UNDEF_FIELD', fieldName) - if src.type == 'getfield' then + if src.type == 'getfield' and src.field then callback { start = src.field.start, finish = src.field.finish, message = message, } - elseif src.type == 'getmethod' then + elseif src.type == 'getmethod' and src.method then callback { start = src.method.start, finish = src.method.finish, diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 01a1f2ba..ba858eaf 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2320,7 +2320,7 @@ function m.pushResult(status, mode, ref, simple) results[#results+1] = ref elseif ref.type == 'getindex' then -- do not trust `t[1]` - if ref.index.type == 'string' then + if ref.index and ref.index.type == 'string' then results[#results+1] = ref end elseif ref.type == 'setglobal' diff --git a/script/vm/guideInterface.lua b/script/vm/guideInterface.lua index a73067c5..7fd515eb 100644 --- a/script/vm/guideInterface.lua +++ b/script/vm/guideInterface.lua @@ -22,7 +22,7 @@ function m.searchFileReturn(results, ast, index) end function m.require(args, index) - local reqName = args[1] and args[1][1] + local reqName = args and args[1] and args[1][1] if not reqName then return nil end |