summaryrefslogtreecommitdiff
path: root/server/src/vm/value.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-04 15:46:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-04 15:46:07 +0800
commit4dddd5e97906202f772642486c6e55ae89d67f81 (patch)
treeed07c1354136332da0ae5aed46b5712879d77ac4 /server/src/vm/value.lua
parent9eec125d9975b6ee44646d1fad0b6c406b2507a5 (diff)
downloadlua-language-server-4dddd5e97906202f772642486c6e55ae89d67f81.zip
简单类型腿短
Diffstat (limited to 'server/src/vm/value.lua')
-rw-r--r--server/src/vm/value.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index 66f15da2..18b92667 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -72,11 +72,13 @@ function mt:rawGet(index)
end
function mt:setChild(index, value)
+ self:setType('table', 0.5)
self:rawSet(index, value)
return value
end
function mt:getChild(index, mark)
+ self:setType('table', 0.5)
local value = self:rawGet(index)
if value then
return value
@@ -213,6 +215,7 @@ function mt:setFunction(func)
end
function mt:getFunction()
+ self:setType('function', 0.5)
return self._func
end
@@ -224,13 +227,18 @@ function mt:getLib()
return self._lib
end
-return function (tp, source)
+function mt:getLiteral()
+ return self._literal
+end
+
+return function (tp, source, literal)
if tp == '...' then
error('Value type cant be ...')
end
local self = setmetatable({
source = source or getDefaultSource(),
_type = {},
+ _literal = literal,
}, mt)
if type(tp) == 'table' then
for i = 1, #tp do