diff --git a/ets2panda/compiler/lowering/ets/objectIterator.cpp b/ets2panda/compiler/lowering/ets/objectIterator.cpp index 6e7bf4535a7c800b4b25ec8d07bbe209c907b69d..6f6cd05334cc59c273e08c59db2d8f0fb7b7f2b6 100644 --- a/ets2panda/compiler/lowering/ets/objectIterator.cpp +++ b/ets2panda/compiler/lowering/ets/objectIterator.cpp @@ -176,17 +176,16 @@ ir::Statement *ObjectIteratorLowering::ProcessObjectIterator(public_lib::Context loweringResult->SetParent(forOfStatement->Parent()); loweringResult->SetRange(forOfStatement->Range()); - auto loweredWhile = loweringResult->AsBlockStatement()->Statements()[WHILE_LOOP_POSITION]->AsWhileStatement(); - auto whileBody = loweredWhile->Body()->AsBlockStatement(); - TransferForOfLoopBody(forOfStatement->Body(), whileBody); + TransferForOfLoopBody(forOfStatement->Body(), loweringResult->AsBlockStatement() + ->Statements()[WHILE_LOOP_POSITION] + ->AsWhileStatement() + ->Body() + ->AsBlockStatement()); auto *const checker = ctx->checker->AsETSChecker(); ES2PANDA_ASSERT(checker != nullptr); CheckLoweredNode(varbinder, checker, loweringResult); - if (loweringResult->Parent()->IsLabelledStatement()) { - loweringResult->Parent()->AsLabelledStatement()->Ident()->Variable()->GetScope()->BindNode(loweringResult); - } return loweringResult; } diff --git a/ets2panda/ir/statements/continueStatement.cpp b/ets2panda/ir/statements/continueStatement.cpp index ab35d97e73d831665c191f4fa47d44d332fa3222..8b73763a7df2abd5019f0e0754a4a165038a69f4 100644 --- a/ets2panda/ir/statements/continueStatement.cpp +++ b/ets2panda/ir/statements/continueStatement.cpp @@ -46,12 +46,7 @@ void ContinueStatement::Dump(ir::AstDumper *dumper) const void ContinueStatement::Dump(ir::SrcDumper *dumper) const { - dumper->Add("continue"); - if (Ident() != nullptr) { - dumper->Add(" "); - Ident()->Dump(dumper); - } - dumper->Add(";"); + dumper->Add("continue;"); } void ContinueStatement::Compile(compiler::PandaGen *pg) const diff --git a/ets2panda/test/ast/parser/ets/labelled_for_of.ets b/ets2panda/test/ast/parser/ets/labelled_for_of.ets deleted file mode 100644 index 882614cc8d9da10302208bec0ef343e56a12aa09..0000000000000000000000000000000000000000 --- a/ets2panda/test/ast/parser/ets/labelled_for_of.ets +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function foo(){ - let arr1: int[] = [0,1,2] - loop1: for(let y of arr1){ - continue loop1; - } -} diff --git a/ets2panda/test/runtime/ets/fix_labelled.ets b/ets2panda/test/runtime/ets/fix_labelled.ets deleted file mode 100644 index 4b207bda5c3cdb5c55c172338fe7e5eb21f4d946..0000000000000000000000000000000000000000 --- a/ets2panda/test/runtime/ets/fix_labelled.ets +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -function main(){ - let arr1: int[] = [0,1,2,3,4,5] - let arr2: int[] = [6,7,8,9,10,11] - let sum=0 - loop1: for(let y of arr1){ - for(let c of arr2){ - sum+=c*y - continue loop1; - } - } - arktest.assertEQ(sum, 6*(1+2+3+4+5)) -} \ No newline at end of file