summaryrefslogtreecommitdiff
path: root/script/core/noder.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-05 16:17:52 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-05 16:17:52 +0800
commit788709d4e2a2ae1d412a0afcfddbfbce19d04099 (patch)
treea7445a7cf8aff0b5ac5c3511e6e2d38dc11057eb /script/core/noder.lua
parent14f8d12a617e1a3ec0e3483cbae3447afa7a7aa8 (diff)
downloadlua-language-server-788709d4e2a2ae1d412a0afcfddbfbce19d04099.zip
#511 supports `doc.type.literaltable`
Diffstat (limited to 'script/core/noder.lua')
-rw-r--r--script/core/noder.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 42079a9c..eac1b9f5 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -218,6 +218,10 @@ local function getKey(source)
return 'de:' .. source.start
elseif source.type == 'doc.type.table' then
return 'dtable:' .. source.start
+ elseif source.type == 'doc.type.ltable' then
+ return 'dltable:' .. source.start
+ elseif source.type == 'doc.type.field' then
+ return 'dfield:' .. source.start
elseif source.type == 'doc.type.array' then
return 'darray:' .. source.start
elseif source.type == 'doc.type.function' then
@@ -830,6 +834,31 @@ function m.compileNode(noders, source)
pushForward(noders, valueID, getID(source.tvalue))
end
end
+ if source.type == 'doc.type.ltable' then
+ local firstField = source.fields[1]
+ if not firstField then
+ return
+ end
+ local keyID = ('%s%s'):format(
+ id,
+ WEAK_TABLE_KEY
+ )
+ local valueID = ('%s%s'):format(
+ id,
+ WEAK_ANY_FIELD
+ )
+ pushForward(noders, keyID, 'dn:string')
+ pushForward(noders, valueID, getID(firstField.extends))
+ for _, field in ipairs(source.fields) do
+ local extendsID = ('%s%s%q'):format(
+ id,
+ SPLIT_CHAR,
+ field.name[1]
+ )
+ pushForward(noders, extendsID, getID(field))
+ pushForward(noders, extendsID, getID(field.extends))
+ end
+ end
if source.type == 'doc.type.array' then
if source.node then
local nodeID = ('%s%s'):format(
@@ -1061,6 +1090,9 @@ function m.compileNode(noders, source)
pushForward(noders, valueID, getID(source.tvalue))
end
end
+ if proto.type == 'doc.type.ltable' then
+ -- TODO
+ end
end
end