From 78d6da054e07c7f42091aa204d642f9b23d0d482 Mon Sep 17 00:00:00 2001 From: jacopodl Date: Tue, 5 Mar 2024 15:25:20 +0100 Subject: [PATCH] fix: correct an error preventing correct compilation of the 'break' statement when inside a switch --- argon/lang/compiler2/transl_unit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/argon/lang/compiler2/transl_unit.cpp b/argon/lang/compiler2/transl_unit.cpp index 5f454551..e49856c3 100644 --- a/argon/lang/compiler2/transl_unit.cpp +++ b/argon/lang/compiler2/transl_unit.cpp @@ -162,12 +162,12 @@ JBlock *TranslationUnit::JBFindLabel(const String *label, unsigned short &out_po for (auto *block = this->jblock; block != nullptr; block = block->prev) { out_pops += block->pops; + if (label == nullptr && (block->type == JBlockType::LOOP || block->type == JBlockType::SWITCH)) + return block; + if (block->type != JBlockType::LOOP) continue; - if (label == nullptr) - return block; - if (block->label != nullptr && StringCompare(block->label, label) == 0) return block; }