From f5fcab05b5a30373d1b35689d456090c8299c4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 11 Aug 2023 18:12:04 +0800 Subject: support `---@type` and `--[[@as]]` for return resolve #2144 --- script/vm/compiler.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'script/vm/compiler.lua') diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 543ee0d4..7faa4f47 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1168,6 +1168,16 @@ local compilerSwitch = util.switch() vm.compileCallArg(source, call) end + if source.parent.type == 'return' then + local myIndex = util.arrayIndexOf(source.parent, source) + ---@cast myIndex -? + local parentNode = vm.selectNode(source.parent, myIndex) + if not parentNode:isEmpty() then + vm.setNode(source, parentNode) + return + end + end + if source.parent.type == 'setglobal' or source.parent.type == 'local' or source.parent.type == 'setlocal' -- cgit v1.2.3