summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-07-21 15:13:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-07-21 15:13:30 +0800
commit7c636357622b7b20e9729c902b5682a05995b911 (patch)
treeae04496840f3c0b449cf11c8fc0f71c6bf08ae03 /script/vm
parent998927a2c8f33dabf8b079657f111a03f37570af (diff)
downloadlua-language-server-7c636357622b7b20e9729c902b5682a05995b911.zip
fix missing fields
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/global.lua1
-rw-r--r--script/vm/operator.lua8
2 files changed, 9 insertions, 0 deletions
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,