From 7155b72aea44f631141ab84748e6052cb9da0838 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, 16 Dec 2022 03:50:50 +0800 Subject: fix --- script/vm/tracer.lua | 6 +++--- test/type_inference/init.lua | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua index cbd7d855..f8d99800 100644 --- a/script/vm/tracer.lua +++ b/script/vm/tracer.lua @@ -454,13 +454,13 @@ end function mt:lookIntoBlock(block, start, node) self:resetCastsIndex(start) for _, action in ipairs(block) do - if action.start < start then + if (action.effect or action.start) < start then goto CONTINUE end if self.careMap[action] then node = self:lookIntoChild(action, node) end - if self.assignMap[action] then + if action.finish > start and self.assignMap[action] then break end ::CONTINUE:: @@ -472,7 +472,7 @@ function mt:calcNode(source) if source.type == 'getlocal' then local lastAssign = self:getLastAssign(0, source.start) if not lastAssign then - return + lastAssign = source.node end self:calcNode(lastAssign) return diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index b8ca4df9..85cbf683 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -4074,3 +4074,9 @@ else print() end ]] + +TEST 'function' [[ +local function x() + print() +end +]] -- cgit v1.2.3