diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/references.lua | 10 | ||||
-rw-r--r-- | server/src/vm/value.lua | 3 | ||||
-rw-r--r-- | server/test/references/init.lua | 9 |
3 files changed, 22 insertions, 0 deletions
diff --git a/server/src/core/references.lua b/server/src/core/references.lua index dfd26575..4bd26b07 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -24,6 +24,16 @@ local function parseResult(vm, source, declarat, callback) end) return end + if source:bindFunction() then + if declarat then + callback(source:bindFunction():getSource()) + end + source:bindFunction():eachInfo(function (info, src) + if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then + callback(src) + end + end) + end if source:bindValue() then source:bindValue():eachInfo(function (info, src) if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 4cbc47f9..c0f55b9d 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -315,6 +315,9 @@ function mt:addInfo(tp, source, ...) if not id then error('Not instanted source') end + if not tp then + error('Miss info type') + end if self._info[id] then return end diff --git a/server/test/references/init.lua b/server/test/references/init.lua index bcaafbbc..6a8b42db 100644 --- a/server/test/references/init.lua +++ b/server/test/references/init.lua @@ -85,3 +85,12 @@ function <!mt!>:a() <?self?>:remove() end ]] + +TEST [[ +local function f() + return <?function () + end?> +end + +local <!f2!> = f() +]] |