diff options
Diffstat (limited to 'server/src/matcher/vm.lua')
-rw-r--r-- | server/src/matcher/vm.lua | 14 |
1 files changed, 12 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 |