From 7d51c01c0b9f4ab70d1ee95950d481cbc40f9092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 24 Apr 2022 05:37:32 +0800 Subject: infer by `break` --- script/vm/runner.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'script/vm/runner.lua') diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 75de2c0f..ccb3bcfb 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -193,7 +193,8 @@ function mt:_compileBlock(block) self.steps[#self.steps+1] = blockStep self:_compileNarrowByFilter(childBlock.filter, outStep, blockStep) if not childBlock.hasReturn - and not childBlock.hasGoTo then + and not childBlock.hasGoTo + and not childBlock.hasBreak then finals[#finals+1] = blockStep end self.steps[#self.steps+1] = { @@ -212,7 +213,12 @@ function mt:_compileBlock(block) end end - if block.type == 'function' then + if block.type == 'function' + or block.type == 'while' + or block.type == 'loop' + or block.type == 'in' + or block.type == 'repeat' + or block.type == 'for' then self.steps[#self.steps+1] = { type = 'load', pos = block.start, -- cgit v1.2.3