summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/parser/luadoc.lua3
-rw-r--r--script/vm/compiler.lua4
-rw-r--r--script/vm/doc.lua36
-rw-r--r--script/vm/node.lua1
4 files changed, 43 insertions, 1 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 6c63e2f9..dbfc6493 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -144,6 +144,9 @@ Symbol <- ({} {
---@field as? parser.object
---@field touch? integer
---@field module? string
+---@field async? boolean
+---@field versions? table[]
+---@field names? parser.object[]
local function trim(str)
return str:match '^%s*(%S+)%s*$'
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 7e26e08f..a1fa395c 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -505,6 +505,7 @@ function vm.getReturnOfFunction(func, index)
return nil
end
+---@param args parser.object[]
---@return vm.node
local function getReturnOfSetMetaTable(args)
local tbl = args[1]
@@ -560,6 +561,9 @@ local function matchCall(source)
end
end
+---@param func parser.object
+---@param index integer
+---@param args parser.object[]
---@return vm.node
local function getReturn(func, index, args)
if not func._callReturns then
diff --git a/script/vm/doc.lua b/script/vm/doc.lua
index 31d7f0ff..15dfde89 100644
--- a/script/vm/doc.lua
+++ b/script/vm/doc.lua
@@ -20,6 +20,8 @@ function vm.getDocSets(suri, name)
end
end
+---@param uri uri
+---@return boolean
function vm.isMetaFile(uri)
local status = files.getState(uri)
if not status then
@@ -45,6 +47,8 @@ function vm.isMetaFile(uri)
return false
end
+---@param doc parser.object
+---@return table<string, boolean>?
function vm.getValidVersions(doc)
if doc.type ~= 'doc.version' then
return
@@ -87,6 +91,7 @@ function vm.getValidVersions(doc)
return valids
end
+---@param value parser.object
---@return parser.object?
local function getDeprecated(value)
if not value.bindDocs then
@@ -111,6 +116,8 @@ local function getDeprecated(value)
return nil
end
+---@param value parser.object
+---@param deep boolean?
---@return parser.object?
function vm.getDeprecated(value, deep)
if deep then
@@ -138,6 +145,8 @@ function vm.getDeprecated(value, deep)
end
end
+---@param value parser.object
+---@return boolean
local function isAsync(value)
if value.type == 'function' then
if not value.bindDocs then
@@ -158,6 +167,9 @@ local function isAsync(value)
return value.async == true
end
+---@param value parser.object
+---@param deep boolean?
+---@return boolean
function vm.isAsync(value, deep)
if isAsync(value) then
return true
@@ -176,6 +188,8 @@ function vm.isAsync(value, deep)
return false
end
+---@param value parser.object
+---@return boolean
local function isNoDiscard(value)
if value.type == 'function' then
if not value.bindDocs then
@@ -196,6 +210,9 @@ local function isNoDiscard(value)
return false
end
+---@param value parser.object
+---@param deep boolean?
+---@return boolean
function vm.isNoDiscard(value, deep)
if isNoDiscard(value) then
return true
@@ -214,6 +231,8 @@ function vm.isNoDiscard(value, deep)
return false
end
+---@param param parser.object
+---@return boolean
local function isCalledInFunction(param)
if not param.ref then
return false
@@ -238,6 +257,9 @@ local function isCalledInFunction(param)
return false
end
+---@param node parser.object
+---@param index integer
+---@return boolean
local function isLinkedCall(node, index)
for _, def in ipairs(vm.getDefs(node)) do
if def.type == 'function' then
@@ -252,16 +274,21 @@ local function isLinkedCall(node, index)
return false
end
+---@param node parser.object
+---@param index integer
+---@return boolean
function vm.isLinkedCall(node, index)
return isLinkedCall(node, index)
end
+---@param call parser.object
+---@return boolean
function vm.isAsyncCall(call)
if vm.isAsync(call.node, true) then
return true
end
if not call.args then
- return
+ return false
end
for i, arg in ipairs(call.args) do
if vm.isAsync(arg, true)
@@ -272,6 +299,9 @@ function vm.isAsyncCall(call)
return false
end
+---@param uri uri
+---@param doc parser.object
+---@param results table[]
local function makeDiagRange(uri, doc, results)
local names
if doc.names then
@@ -325,6 +355,10 @@ local function makeDiagRange(uri, doc, results)
end
end
+---@param uri uri
+---@param position integer
+---@param name string
+---@return boolean
function vm.isDiagDisabledAt(uri, position, name)
local status = files.getState(uri)
if not status then
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 3b6e9afb..45e5e6c4 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -74,6 +74,7 @@ function mt:setData(k, v)
self.data[k] = v
end
+---@return any
function mt:getData(k)
if not self.data then
return nil