From ad626d2cfdc9b64c4d2d86dc5e0d352c37788eef 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 03:39:07 +0800 Subject: cleanup --- script/vm/runner.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'script/vm/runner.lua') diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 2771b0a9..2ad1bc4a 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -156,7 +156,6 @@ function mt:_compileBlock(block) tag = 'out', copy = true, pos = block.start, - order = 1, } self.steps[#self.steps+1] = outStep local blockStep = { @@ -165,7 +164,6 @@ function mt:_compileBlock(block) copy = true, ref = outStep, pos = childBlock.start, - order = 2, } self.steps[#self.steps+1] = blockStep self:_compileNarrowByFilter(childBlock.filter, outStep, blockStep) @@ -177,7 +175,6 @@ function mt:_compileBlock(block) tag = 'final', ref1 = outStep, pos = childBlock.finish, - order = 1, } end for i, final in ipairs(finals) do @@ -185,7 +182,6 @@ function mt:_compileBlock(block) type = 'merge', ref2 = final, pos = block.finish, - order = i, } end end @@ -194,13 +190,11 @@ function mt:_compileBlock(block) self.steps[#self.steps+1] = { type = 'load', pos = block.start, - order = 1, } local savePoint = { type = 'save', copy = true, pos = block.start, - order = 2, } self.steps[#self.steps+1] = savePoint self.steps[#self.steps+1] = { @@ -221,6 +215,11 @@ function mt:_preCompile() local block = guide.getParentBlock(ref) self:_compileBlock(block) end + for i, step in ipairs(self.steps) do + if step.type ~= 'object' then + step.order = i + end + end table.sort(self.steps, function (a, b) if a.pos == b.pos then return (a.order or 0) < (b.order or 0) -- cgit v1.2.3