summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-08 18:31:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-08 18:31:50 +0800
commit9e8ae91901c096be13e6c7ef0cf865b0be7d0538 (patch)
tree154c1db2cf1209a7a84ba68889b10f90f260b428 /script/vm/compiler.lua
parentd10eb1c80d40fe2b511a594888586862e69c6a35 (diff)
downloadlua-language-server-9e8ae91901c096be13e6c7ef0cf865b0be7d0538.zip
fix
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index c92c224a..19955372 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -20,19 +20,28 @@ local m = {}
local searchFieldSwitch = util.switch()
: case 'table'
: call(function (node, key, pushResult)
+ local tp
+ if type(key) == 'table'
+ and key.type == 'global'
+ and key.cate == 'type' then
+ tp = key.name
+ end
local hasFiled = false
for _, field in ipairs(node) do
if field.type == 'tablefield'
or field.type == 'tableindex' then
+ local fieldKey = guide.getKeyName(field)
if key == nil
- or key == guide.getKeyName(field) then
+ or key == fieldKey
+ or (tp == 'integer' and math.tointeger(fieldKey)) then
hasFiled = true
pushResult(field)
end
end
if field.type == 'tableexp' then
if key == nil
- or key == field.tindex then
+ or key == field.tindex
+ or tp == 'integer' then
hasFiled = true
pushResult(field)
end