diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/matcher/vm.lua | 14 | ||||
-rw-r--r-- | server/test/diagnostics/init.lua | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index e7863e47..23a74c7f 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -38,6 +38,16 @@ end local mt = {} mt.__index = mt +function mt:createDummyVar(source, value) + local loc = { + type = 'local', + key = '', + source = source or DefaultSource, + } + self:setValue(loc, value, source) + return loc +end + function mt:createLocal(key, source, value) local loc = { type = 'local', @@ -784,11 +794,11 @@ function mt:getSimple(simple, mode) parentName = field.key elseif tp == 'string' or tp == 'number' or tp == 'nil' or tp == 'boolean' then local v = self:createValue(tp, simple[1], simple[1][1]) - field = self:createLocal('', simple[1], v) + field = self:createDummyVar(simple[1], v) parentName = '*' .. tp else local v = self:createValue('any', simple[1]) - field = self:createLocal('', simple[1], v) + field = self:createDummyVar(simple[1], v) parentName = '?' end local object diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index 9ea8b4bd..4fb15448 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -143,6 +143,10 @@ instanceName = 1 instance = _G[instanceName] ]] +TEST [[ +(''):sub(1, 2) +]] + -- TODO --TEST [=[ --return [[ |