diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 17:27:40 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 17:27:40 +0800 |
commit | 94da0c9d659f7ac01bf75ccdc37f236e90f8900a (patch) | |
tree | c0ed217980e23d72fde42305378e0cb8ec873ea2 /server | |
parent | 8d112ba2f517e9ca6cf4146c16d713f8d7eabd03 (diff) | |
download | lua-language-server-94da0c9d659f7ac01bf75ccdc37f236e90f8900a.zip |
略微优化
Diffstat (limited to 'server')
-rw-r--r-- | server/src/matcher/vm.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index d9f117f8..92e5511f 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -181,7 +181,9 @@ function mt:mergeChild(a, b, mark) end function mt:setValue(var, value, source) - assert(not value or value.type ~= 'list') + if value and value.type == 'list' then + error('Cant set value list') + end value = value or self:createValue('nil', source) if var.value then if value.type == 'nil' then @@ -207,15 +209,15 @@ function mt:getValue(var) end function mt:createField(pValue, name, source) - assert(pValue.type ~= 'local' and pValue.type ~= 'field') + if pValue.type == 'local' or pValue.type == 'field' then + error('Only value can create field') + end local field = { type = 'field', key = name, source = source or DefaultSource, } - self.results.fields[#self.results.fields+1] = field - if not pValue.child then pValue.child = {} end @@ -914,7 +916,6 @@ local function compile(ast) }, results = { locals = {}, - fields = {}, labels = {}, funcs = {}, calls = {}, |