diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/hover_function.lua | 7 | ||||
-rw-r--r-- | server/src/core/hover_name.lua | 16 | ||||
-rw-r--r-- | server/src/vm/function.lua | 13 |
3 files changed, 30 insertions, 6 deletions
diff --git a/server/src/core/hover_function.lua b/server/src/core/hover_function.lua index d877a0d8..0eef37df 100644 --- a/server/src/core/hover_function.lua +++ b/server/src/core/hover_function.lua @@ -1,9 +1,12 @@ local function buildValueArgs(func, object, select) local names = {} local values = {} + if func:getObject() then + names[#names+1] = 'self' + end if func.args then - for i, arg in ipairs(func.args) do - names[i] = arg:getName() + for _, arg in ipairs(func.args) do + names[#names+1] = arg:getName() end end if func.argValues then diff --git a/server/src/core/hover_name.lua b/server/src/core/hover_name.lua index 119a9349..3c0c9564 100644 --- a/server/src/core/hover_name.lua +++ b/server/src/core/hover_name.lua @@ -18,6 +18,22 @@ return function (source) key = ('%q'):format(declarat[1]) elseif declarat.type == 'number' or declarat.type == 'boolean' then key = tostring(declarat[1]) + elseif declarat.type == 'simple' then + local chars = {} + for i, obj in ipairs(declarat) do + if obj.type == 'name' then + chars[i] = obj[1] + elseif obj.type == 'index' then + chars[i] = '[?]' + elseif obj.type == 'call' then + chars[i] = '(?)' + elseif obj.type == ':' then + chars[i] = ':' + elseif obj.type == '.' then + chars[i] = '.' + end + end + key = table.concat(chars) else key = '' end diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index 8eebb59c..976f8ab2 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -158,7 +158,9 @@ function mt:run() end function mt:setArgs(values) - self.argValues = {} + for i = 1, #self.argValues do + self.argValues[i] = nil + end for i = 1, #values do self.argValues[i] = values[i] end @@ -171,7 +173,7 @@ function mt:createArg(arg, values) self:saveLocal(arg[1], loc) self.args[#self.args+1] = loc elseif arg.type == '...' then - self._dots = createMulti(values) + self._dots = createMulti() for i = 1, #values do self._dots:set(i, values[i]) end @@ -201,8 +203,10 @@ function mt:createArgs() if not args then return end - local values = self.argValues or {} - self.argValues = nil + local values = {} + for i, value in ipairs(self.argValues) do + values[i] = value + end if args.type == 'list' then for _, arg in ipairs(args) do self:createArg(arg, values) @@ -231,6 +235,7 @@ return function (source) source = source, locals = {}, args = {}, + argValues = {}, }, mt) self:push() return self |