From 75b8b11130cb3baae68082eaa49ecef9a8570e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 28 Jun 2022 15:29:18 +0800 Subject: special treat `local x; x = function() end` --- script/vm/compiler.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'script') diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index c249b44d..b2cdb1be 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1008,6 +1008,17 @@ local function compileLocal(source) vm.setNode(source, vm.compileNode(source.value)) end end + if not hasMarkValue and not hasMarkValue then + if source.ref then + for _, ref in ipairs(source.ref) do + if ref.type == 'setlocal' + and ref.value + and ref.value.type == 'function' then + vm.setNode(source, vm.compileNode(ref.value)) + end + end + end + end -- function x.y(self, ...) --> function x:y(...) if source[1] == 'self' and not hasMarkDoc -- cgit v1.2.3