From c65ead24430d0cb3b0af3f896df43827dbf7bbb2 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 11 Feb 2026 17:38:58 +0800 Subject: Fixed issues. --- src/yuescript/yue_compiler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index bd52d33..caeee53 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -10391,6 +10391,10 @@ private: if (breakWithVar.empty()) { transformIf(ifNode, temp, ExpUsage::Common); } else { + if (extraBreakVar) { + addToScope(breakWithVar); + temp.push_back(indent() + "local "s + breakWithVar + nl(with)); + } auto simpleValue = x->new_ptr(); simpleValue->value.set(ifNode); auto exp = newExp(simpleValue, x); @@ -10404,10 +10408,7 @@ private: auto block = x->new_ptr(); block->statementOrComments.push_back(stmt); repeatNode->body.set(block); - auto sVal = x->new_ptr(); - sVal->value.set(repeatNode); - auto asmt = assignmentFrom(toAst(breakWithVar, x), newExp(sVal, x), x); - transformAssignment(asmt, temp); + transformRepeat(repeatNode, temp); } } else { bool transformed = false; -- cgit v1.2.3-55-g6feb