summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/infer.lua3
-rw-r--r--script/core/noder.lua32
-rw-r--r--script/core/searcher.lua9
-rw-r--r--script/core/type-definition.lua3
4 files changed, 46 insertions, 1 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index ef3076b7..ed802a58 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -381,6 +381,9 @@ function m.getDocName(doc)
local value = doc[1] or '?'
return value
end
+ if doc.type == 'doc.type.ltable' then
+ return 'table'
+ end
end
function m.viewDocFunction(doc)
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
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 550fadfd..fa70ab35 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -71,6 +71,8 @@ function m.pushResult(status, mode, source, force)
or source.type == 'doc.resume'
or source.type == 'doc.type.array'
or source.type == 'doc.type.table'
+ or source.type == 'doc.type.ltable'
+ or source.type == 'doc.type.field'
or source.type == 'doc.type.function' then
results[#results+1] = source
return
@@ -117,6 +119,8 @@ function m.pushResult(status, mode, source, force)
or source.type == 'doc.resume'
or source.type == 'doc.type.array'
or source.type == 'doc.type.table'
+ or source.type == 'doc.type.ltable'
+ or source.type == 'doc.type.field'
or source.type == 'doc.type.function' then
results[#results+1] = source
return
@@ -767,6 +771,11 @@ local function getField(status, source, mode)
end
return
end
+ if source.type == 'doc.type.ltable' then
+ for _, field in ipairs(source.fields) do
+ m.pushResult(status, mode, field)
+ end
+ end
if source.type == 'doc.class.name' then
local class = source.parent
for _, field in ipairs(class.fields) do
diff --git a/script/core/type-definition.lua b/script/core/type-definition.lua
index abfe525b..4dd9ac32 100644
--- a/script/core/type-definition.lua
+++ b/script/core/type-definition.lua
@@ -156,7 +156,8 @@ return function (uri, offset)
or src.type == 'doc.alias.name'
or src.type == 'doc.type.function'
or src.type == 'doc.type.array'
- or src.type == 'doc.type.table' then
+ or src.type == 'doc.type.table'
+ or src.type == 'doc.type.ltable' then
results[#results+1] = {
target = src,
uri = files.getOriginUri(root.uri),