summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-30 12:01:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-30 12:01:34 +0800
commitf5d631b87b38a54b8cb40dec602a7f1910fe7e4f (patch)
treedb2c1715e43ec4cf7c466578c44c3c6fdb9b2a67 /script/vm
parentde82efa9bf794ea195c4d1b3da229500c8a213e1 (diff)
downloadlua-language-server-f5d631b87b38a54b8cb40dec602a7f1910fe7e4f.zip
respect quotation marks
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua3
-rw-r--r--script/vm/infer.lua7
2 files changed, 8 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 3342710a..a3057629 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1177,7 +1177,8 @@ local compilerSwitch = util.switch()
end
-- { f = function (<?x?>) end }
- if guide.isAssign(parent) then
+ if guide.isAssign(parent)
+ and parent.value == source then
vm.setNode(source, vm.compileNode(parent))
end
end)
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index 0b5a6dcb..74cab4ed 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -483,7 +483,12 @@ function mt:viewLiterals()
or n.type == 'number'
or n.type == 'integer'
or n.type == 'boolean' then
- local literal = util.viewLiteral(n[1])
+ local literal
+ if n.type == 'string' then
+ literal = util.viewString(n[1], n[2])
+ else
+ literal = util.viewLiteral(n[1])
+ end
if literal and not mark[literal] then
literals[#literals+1] = literal
mark[literal] = true