diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/main.lua | 2 | ||||
-rw-r--r-- | server/src/core/hover/hover.lua | 10 | ||||
-rw-r--r-- | server/src/service.lua | 2 | ||||
-rw-r--r-- | server/src/vm/local.lua | 6 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 15 | ||||
-rw-r--r-- | server/test/hover/init.lua | 22 |
6 files changed, 42 insertions, 15 deletions
diff --git a/server/main.lua b/server/main.lua index 685fce01..ac7860c5 100644 --- a/server/main.lua +++ b/server/main.lua @@ -22,7 +22,7 @@ local function tryDebugger() log.info('Debugger startup, listen port: 11411') end -pcall(tryDebugger) +--pcall(tryDebugger) require 'utility' require 'global_protect' diff --git a/server/src/core/hover/hover.lua b/server/src/core/hover/hover.lua index 058ddd4a..550129a4 100644 --- a/server/src/core/hover/hover.lua +++ b/server/src/core/hover/hover.lua @@ -127,13 +127,11 @@ end local function getValueHover(source, name, value, lib) local valueType = value:getType() - local class + local class = findClass(value) - if not lib then - class = findClass(value) - if class then - valueType = class - end + if class then + valueType = class + lib = nil end if not OriginTypes[valueType] then diff --git a/server/src/service.lua b/server/src/service.lua index 01d3424d..bc13e31c 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -435,7 +435,7 @@ function mt:compileVM(uri) local version = obj.version obj.astCost = os.clock() - clock if obj.astCost > 0.1 then - log.warn(('Compile[%s] takes [%.3f] sec, size [%.3f]kb'):format(uri, obj.astCost, #obj.text)) + log.warn(('Compile Ast[%s] takes [%.3f] sec, size [%.3f]kb'):format(uri, obj.astCost, #obj.text / 1000)) end obj.oldText = nil diff --git a/server/src/vm/local.lua b/server/src/vm/local.lua index c20224de..11e3c8de 100644 --- a/server/src/vm/local.lua +++ b/server/src/vm/local.lua @@ -113,12 +113,6 @@ function mt:shadow(old) group[#group+1] = self self._shadow = group - if not self:getSource() then - log.debug('not self:getSource()', table.dump(self)) - end - if not old.close then - log.debug('not old.close', table.dump(old)) - end old:close(self:getSource().start - 1) end diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 0aae9f51..031388f4 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -892,6 +892,7 @@ function mt:doLoop(action) end function mt:doIn(action) + local emmyParams = self:getEmmyParams() self:instantSource(action) local args = self:unpackList(action.exp) @@ -899,7 +900,16 @@ function mt:doIn(action) local func = table.remove(args, 1) or valueMgr.create('any', self:getDefaultSource()) local values = self:call(func, args, action) or createMulti() self:forList(action.arg, function (arg) - local value = table.remove(values, 1) + self:instantSource(arg) + local value = table.remove(values, 1) or self:createValue('nil', arg) + if emmyParams then + for i = #emmyParams, 1, -1 do + local emmyParam = emmyParams[i] + if emmyParam and emmyParam:getName() == arg[1] then + value:setEmmy(emmyParam:bindType()) + end + end + end self:createLocal(arg[1], arg, value) end) @@ -1013,6 +1023,9 @@ function mt:doAction(action) coroutine.yield('stop') end end + if self:isRemoved() then + return + end local tp = action.type if tp:sub(1, 4) == 'emmy' then self:doEmmy(action) diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index aadac372..639789e0 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -575,3 +575,25 @@ f(<?s?>) [[ global s: *Class {} ]] + +TEST [[ +---@class Class + +---@param k Class +for <?k?> in pairs(t) do +end +]] +[[ +local k<key>: *Class {} +]] + +TEST [[ +---@class Class + +---@param v Class +for k, <?v?> in pairs(t) do +end +]] +[[ +local v<value>: *Class {} +]] |