diff options
-rw-r--r-- | server/main.lua | 2 | ||||
-rw-r--r-- | server/src/core/references.lua | 8 | ||||
-rw-r--r-- | server/src/service.lua | 1 | ||||
-rw-r--r-- | server/test/references/init.lua | 7 |
4 files changed, 12 insertions, 6 deletions
diff --git a/server/main.lua b/server/main.lua index 4f3dcf71..35b75789 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,7 +6,7 @@ LANG = LANG or 'en-US' package.path = (ROOT / 'src' / '?.lua'):string() .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string() ---collectgarbage('generational') +collectgarbage('generational') log = require 'log' log.init(ROOT, ROOT / 'log' / 'service.log') diff --git a/server/src/core/references.lua b/server/src/core/references.lua index 755612b5..bc6cc39e 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -3,7 +3,7 @@ local findSource = require 'core.find_source' local function parseResult(vm, source, declarat, callback) if source:bindLabel() then source:bindLabel():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and info.type == 'set') or info.type == 'get' then callback(src) end end) @@ -12,12 +12,12 @@ local function parseResult(vm, source, declarat, callback) if source:bindLocal() then local loc = source:bindLocal() loc:eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and info.type == 'set') or info.type == 'get' then callback(src) end end) loc:getValue():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then callback(src) end end) @@ -25,7 +25,7 @@ local function parseResult(vm, source, declarat, callback) end if source:bindValue() then source:bindValue():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then callback(src) end end) diff --git a/server/src/service.lua b/server/src/service.lua index 8b07aa33..20e1a921 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -534,7 +534,6 @@ function mt:onTick() self:_doCompileTask() if os.clock() - self._clock >= 60 then - collectgarbage() self._clock = os.clock() local count = 0 for _ in pairs(self._file) do diff --git a/server/test/references/init.lua b/server/test/references/init.lua index 59026031..bcaafbbc 100644 --- a/server/test/references/init.lua +++ b/server/test/references/init.lua @@ -78,3 +78,10 @@ local t = { } print(t.<!a!>) ]] + +TEST [[ +local <!mt!> = {} +function <!mt!>:a() + <?self?>:remove() +end +]] |