diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-20 19:32:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-20 19:32:48 +0800 |
commit | fa3736b7532a0d64e20e77a667e2e83528e0a01d (patch) | |
tree | 5031501e1a66cf88502843d20ffd7caec0a89e44 /script | |
parent | e81ffc189a1976adf2998f15cae0bd5b141435e2 (diff) | |
download | lua-language-server-fa3736b7532a0d64e20e77a667e2e83528e0a01d.zip |
fix runtime error
Diffstat (limited to 'script')
-rw-r--r-- | script/vm/compiler.lua | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 284b49d0..ca01a138 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -201,11 +201,13 @@ function vm.getClassFields(suri, node, key, ref, pushResult) local hasFounded = {} for _, field in ipairs(set.fields) do local fieldKey = guide.getKeyName(field) - if key == nil - or fieldKey == key then - if not searchedFields[fieldKey] then - pushResult(field) - hasFounded[fieldKey] = true + if fieldKey then + if key == nil + or fieldKey == key then + if not searchedFields[fieldKey] then + pushResult(field) + hasFounded[fieldKey] = true + end end end end @@ -214,19 +216,23 @@ function vm.getClassFields(suri, node, key, ref, pushResult) for _, src in ipairs(set.bindSources) do searchFieldSwitch(src.type, suri, src, key, ref, function (field) local fieldKey = guide.getKeyName(field) - if not searchedFields[fieldKey] - and guide.isSet(field) then - hasFounded[fieldKey] = true - pushResult(field) + if fieldKey then + if not searchedFields[fieldKey] + and guide.isSet(field) then + hasFounded[fieldKey] = true + pushResult(field) + end end end) if src.value and src.value.type == 'table' then searchFieldSwitch('table', suri, src.value, key, ref, function (field) local fieldKey = guide.getKeyName(field) - if not searchedFields[fieldKey] - and guide.isSet(field) then - hasFounded[fieldKey] = true - pushResult(field) + if fieldKey then + if not searchedFields[fieldKey] + and guide.isSet(field) then + hasFounded[fieldKey] = true + pushResult(field) + end end end) end |