From 43e36d9e9d3577268066b21417737a68aa23baf8 Mon Sep 17 00:00:00 2001 From: Zelentsov Dmitry Date: Fri, 30 May 2025 16:57:18 +0300 Subject: [PATCH] Fix EnumPostCheckLowering - set correct containing class Signed-off-by: Zelentsov Dmitry --- ets2panda/compiler/lowering/ets/enumPostCheckLowering.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ets2panda/compiler/lowering/ets/enumPostCheckLowering.cpp b/ets2panda/compiler/lowering/ets/enumPostCheckLowering.cpp index 53831d12c..5004eb571 100644 --- a/ets2panda/compiler/lowering/ets/enumPostCheckLowering.cpp +++ b/ets2panda/compiler/lowering/ets/enumPostCheckLowering.cpp @@ -400,11 +400,9 @@ bool EnumPostCheckLoweringPhase::PerformForModule(public_lib::Context *ctx, pars if (node->IsExpression()) { node->AsExpression()->SetTsType(nullptr); // force recheck } - if (checker_->Context().ContainingClass() == nullptr) { - auto *parentClass = util::Helpers::FindAncestorGivenByType(node, ir::AstNodeType::CLASS_DEFINITION); - checker_->Context().SetContainingClass( - parentClass->AsClassDefinition()->TsType()->AsETSObjectType()); - } + auto *parentClass = util::Helpers::FindAncestorGivenByType(node, ir::AstNodeType::CLASS_DEFINITION); + checker::SavedCheckerContext savedContext(checker_, checker_->Context().Status(), + parentClass->AsClassDefinition()->TsType()->AsETSObjectType()); node->RemoveAstNodeFlags(ir::AstNodeFlags::RECHECK); node->Check(checker_); if (node->IsExpression() && node->AsExpression()->TsType() != nullptr && -- Gitee