diff options
-rw-r--r-- | script/core/code-lens.lua | 3 | ||||
-rw-r--r-- | script/core/completion/completion.lua | 1 | ||||
-rw-r--r-- | script/files.lua | 29 | ||||
-rw-r--r-- | script/parser/compile.lua | 2 | ||||
-rw-r--r-- | script/vm/global.lua | 1 | ||||
-rw-r--r-- | script/vm/operator.lua | 8 |
6 files changed, 26 insertions, 18 deletions
diff --git a/script/core/code-lens.lua b/script/core/code-lens.lua index ed95ea6a..bc39ec86 100644 --- a/script/core/code-lens.lua +++ b/script/core/code-lens.lua @@ -6,7 +6,7 @@ local getRef = require 'core.reference' local lang = require 'language' ---@class parser.state ----@field package _codeLens codeLens +---@field package _codeLens? codeLens ---@class codeLens.resolving ---@field mode 'reference' @@ -14,7 +14,6 @@ local lang = require 'language' ---@class codeLens.result ---@field position integer ----@field uri uri ---@field id integer ---@class codeLens diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index 4178293b..15bc0fcb 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1614,6 +1614,7 @@ local function tryCallArg(state, position, results) if arg and arg.type == 'function' then return end + ---@diagnostic disable-next-line: missing-fields local node = vm.compileCallArg({ type = 'dummyarg' }, call, argIndex) if not node then return diff --git a/script/files.lua b/script/files.lua index 62f01136..5c3a1c72 100644 --- a/script/files.lua +++ b/script/files.lua @@ -19,20 +19,19 @@ local sp = require 'bee.subprocess' local pub = require 'pub' ---@class file ----@field uri uri ----@field content string ----@field ref? integer ----@field trusted? boolean ----@field rows? integer[] ----@field originText? string ----@field text string ----@field version? integer ----@field originLines? integer[] ----@field diffInfo? table[] ----@field cache table ----@field id integer ----@field state? parser.state ----@field compileCount integer +---@field uri uri +---@field ref? integer +---@field trusted? boolean +---@field rows? integer[] +---@field originText? string +---@field text? string +---@field version? integer +---@field originLines? integer[] +---@field diffInfo? table[] +---@field cache? table +---@field id integer +---@field state? parser.state +---@field compileCount? integer ---@class files ---@field lazyCache? lazy-cacher @@ -708,7 +707,7 @@ end ---@class parser.state ---@field diffInfo? table[] ---@field originLines? integer[] ----@field originText string +---@field originText? string --- 获取文件语法树 ---@param uri uri diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 7d4d7480..5321d9b8 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -3937,7 +3937,7 @@ local function initState(lua, version, options) else state.ENVMode = '_ENV' end - + pushError = function (err) local errs = state.errs if err.finish < err.start then diff --git a/script/vm/global.lua b/script/vm/global.lua index 6b61a82a..4e2d0617 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -621,6 +621,7 @@ function vm.getGlobalBase(source) end local name = global:asKeyName() if not root._globalBaseMap[name] then + ---@diagnostic disable-next-line: missing-fields root._globalBaseMap[name] = { type = 'globalbase', parent = root, diff --git a/script/vm/operator.lua b/script/vm/operator.lua index bc8703c6..7ce2b30d 100644 --- a/script/vm/operator.lua +++ b/script/vm/operator.lua @@ -126,6 +126,7 @@ vm.unarySwich = util.switch() if result == nil then vm.setNode(source, vm.declareGlobal('type', 'boolean')) else + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'boolean', start = source.start, @@ -155,6 +156,7 @@ vm.unarySwich = util.switch() vm.setNode(source, node or vm.declareGlobal('type', 'number')) end else + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'number', start = source.start, @@ -171,6 +173,7 @@ vm.unarySwich = util.switch() local node = vm.runOperator('bnot', source[1]) vm.setNode(source, node or vm.declareGlobal('type', 'integer')) else + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'integer', start = source.start, @@ -223,6 +226,7 @@ vm.binarySwitch = util.switch() if source.op.type == '~=' then result = not result end + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'boolean', start = source.start, @@ -247,6 +251,7 @@ vm.binarySwitch = util.switch() or op == '&' and a & b or op == '|' and a | b or op == '~' and a ~ b + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'integer', start = source.start, @@ -285,6 +290,7 @@ vm.binarySwitch = util.switch() or op == '%' and a % b or op == '//' and a // b or op == '^' and a ^ b + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = (op == '//' or math.type(result) == 'integer') and 'integer' or 'number', start = source.start, @@ -364,6 +370,7 @@ vm.binarySwitch = util.switch() end end end + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'string', start = source.start, @@ -407,6 +414,7 @@ vm.binarySwitch = util.switch() or op == '<' and a < b or op == '>=' and a >= b or op == '<=' and a <= b + ---@diagnostic disable-next-line: missing-fields vm.setNode(source, { type = 'boolean', start = source.start, |