From c50a20ddad4adb3e0f8ead37a2e6a9960fe3000d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 27 Jun 2022 00:06:48 +0800 Subject: fix #1235 don't drop node in `for`/`while`... --- script/vm/runner.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'script/vm/runner.lua') diff --git a/script/vm/runner.lua b/script/vm/runner.lua index acf5427d..0dd33595 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -137,19 +137,20 @@ function mt:_lookInto(action, topNode, outNode) set = action action = value end - if action.type == 'function' - or action.type == 'loop' + if action.type == 'function' then + self:_launchBlock(action, topNode:copy()) + elseif action.type == 'loop' or action.type == 'in' or action.type == 'repeat' or action.type == 'for' then - self:_launchBlock(action, topNode:copy()) + topNode = self:_launchBlock(action, topNode:copy()) elseif action.type == 'while' then local blockNode, mainNode = self:_lookInto(action.filter, topNode:copy(), topNode:copy()) if action.filter then self:_fastWard(action.filter.finish, blockNode) end - self:_launchBlock(action, blockNode:copy()) - topNode = mainNode + blockNode = self:_launchBlock(action, blockNode:copy()) + topNode = mainNode:merge(blockNode) elseif action.type == 'if' then local hasElse local mainNode = topNode:copy() -- cgit v1.2.3