From 6d5250e96522ee6aaf856d11591c6b4545be2abb Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 15 Dec 2023 10:25:18 +0000 Subject: Inline generateBlockInstructions() --- .../org/shedlang/compiler/patio/PatioCodeGen.java | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java index 5ddcc13c..bb674bc4 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java @@ -879,7 +879,12 @@ public class PatioCodeGen { PatioCodeGenContext context ) { context = context.enterBlock(); - context = generateBlockInstructions(shidBlock, context); + + context = declareShidVariables(shidBlock, context); + + for (var shidInstruction : shidBlock.instructions()) { + context = generateInstruction(shidInstruction, context); + } var targetsResult = context.temporaryPopAll(); var targets = targetsResult.value().reversed(); @@ -896,20 +901,6 @@ public class PatioCodeGen { )); } - // TODO: distinguish the two types of block we've apparently ended up with in Shid. - private static PatioCodeGenContext generateBlockInstructions( - ShidBlock block, - PatioCodeGenContext context - ) { - context = declareShidVariables(block, context); - - for (var shidInstruction : block.instructions()) { - context = generateInstruction(shidInstruction, context); - } - - return context; - } - private static PatioCodeGenResult generateCondition( Source source, PatioCodeGenContext context -- cgit v1.2.3