Skip to content

Commit 78d6da0

Browse files
committed
fix: correct an error preventing correct compilation of the 'break' statement when inside a switch
1 parent 0bcbbd7 commit 78d6da0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

argon/lang/compiler2/transl_unit.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ JBlock *TranslationUnit::JBFindLabel(const String *label, unsigned short &out_po
162162
for (auto *block = this->jblock; block != nullptr; block = block->prev) {
163163
out_pops += block->pops;
164164

165+
if (label == nullptr && (block->type == JBlockType::LOOP || block->type == JBlockType::SWITCH))
166+
return block;
167+
165168
if (block->type != JBlockType::LOOP)
166169
continue;
167170

168-
if (label == nullptr)
169-
return block;
170-
171171
if (block->label != nullptr && StringCompare(block->label, label) == 0)
172172
return block;
173173
}

0 commit comments

Comments
 (0)