diff options
-rw-r--r-- | server/src/matcher/hover.lua | 10 | ||||
-rw-r--r-- | server/src/matcher/vm.lua | 30 |
2 files changed, 15 insertions, 25 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index ef6b8b68..2de5d1fc 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -176,9 +176,6 @@ local function buildValueArgs(result, source) if func.argValues then for i, value in ipairs(func.argValues) do values[i] = value.type - if values[i] == 'nil' then - values[i] = 'any' - end end end local strs = {} @@ -202,9 +199,6 @@ local function buildValueReturns(result) local strs = {} for i, rtn in ipairs(func.returns) do strs[i] = rtn.type - if strs[i] == 'nil' then - strs[i] = 'any' - end end return '\n -> ' .. table.concat(strs, ', ') end @@ -279,10 +273,6 @@ local function findClass(result) end local function getValueHover(name, valueType, result, source, lib) - if valueType == 'nil' then - valueType = 'any' - end - if not lib then local class = findClass(result) if class then diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 1655bba8..2f7bbcf4 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -184,9 +184,9 @@ function mt:setValue(var, value, source) if value and value.type == 'list' then error('Cant set value list') end - value = value or self:createValue('nil', source) + value = value or self:createValue('any', source) if var.value then - if value.type == 'nil' then + if value.type == 'any' then self:mergeChild(var.value, value) else self:mergeValue(var.value, value) @@ -206,7 +206,7 @@ end function mt:getValue(var) if not var.value then - var.value = self:createValue('nil') + var.value = self:createValue('any') end return var.value end @@ -337,7 +337,7 @@ function mt:getFunctionArg(func, i) end if not func.argValues[i] then for n = #func.argValues+1, i do - func.argValues[n] = self:createValue('nil') + func.argValues[n] = self:createValue('any') end end return func.argValues[i] @@ -355,10 +355,10 @@ end function mt:callSetMetaTable(func, values) if not values[1] then - values[1] = self:createValue('nil') + values[1] = self:createValue('any') end if not values[2] then - values[2] = self:createValue('nil') + values[2] = self:createValue('any') end self:setFunctionReturn(func, 1, values[1]) @@ -369,7 +369,7 @@ end function mt:callRequire(func, values) if not values[1] then - values[1] = self:createValue('nil') + values[1] = self:createValue('any') end local str = values[1].value if type(str) == 'string' then @@ -420,7 +420,7 @@ function mt:setFunctionReturn(func, index, value) if not func.returns then func.returns = { type = 'list', - [1] = self:createValue('nil'), + [1] = self:createValue('any'), } end if value then @@ -432,7 +432,7 @@ function mt:setFunctionReturn(func, index, value) func.returns[index] = value end else - func.returns[index] = self:createValue('nil') + func.returns[index] = self:createValue('any') end end @@ -440,13 +440,13 @@ function mt:getFunctionReturns(func, i) if not func.returns then func.returns = { type = 'list', - [1] = self:createValue('nil'), + [1] = self:createValue('any'), } end if i then if not func.returns[i] then for n = #func.returns+1, i do - func.returns[n] = self:createValue('nil') + func.returns[n] = self:createValue('any') end end return func.returns[i] @@ -456,7 +456,7 @@ function mt:getFunctionReturns(func, i) end function mt:inference(value, type) - if value.type == 'nil' then + if value.type == 'any' then value.type = type end end @@ -513,7 +513,7 @@ function mt:getLibValue(lib, parentType, v) if lib.args then local values = {} for i, arg in ipairs(lib.args) do - values[i] = self:getLibValue(arg, parentType) or self:createValue('nil') + values[i] = self:getLibValue(arg, parentType) or self:createValue('any') end self:setFunctionArg(value, values) end @@ -607,7 +607,7 @@ function mt:getSimple(simple, mode) field = self:getName(simple[1][1]) parentName = field.key else - field = self:createValue('nil', simple[1]) + field = self:createValue('any', simple[1]) parentName = '?' end local object @@ -624,7 +624,7 @@ function mt:getSimple(simple, mode) -- 函数的返回值一定是list value = self:call(value, args) if i < #simple then - value = value[1] or self:createValue('nil') + value = value[1] or self:createValue('any') end self.results.calls[#self.results.calls+1] = { call = obj, |