From 9935e7c06caae29d2e133e3345fcc8928ce8e148 Mon Sep 17 00:00:00 2001 From: oh-rgx Date: Thu, 5 Jun 2025 17:24:41 +0800 Subject: [PATCH] fix diagnostic flush Issue: #ICDC8T Signed-off-by: oh-rgx --- ets2panda/public/es2panda_lib.cpp | 10 +--------- .../ast_verifier_check_struct_declaration_test.cpp | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ets2panda/public/es2panda_lib.cpp b/ets2panda/public/es2panda_lib.cpp index 14a173532e..3ba94058e7 100644 --- a/ets2panda/public/es2panda_lib.cpp +++ b/ets2panda/public/es2panda_lib.cpp @@ -500,10 +500,7 @@ __attribute__((unused)) static Context *Parse(Context *ctx) ctx->parser->ParseScript(*ctx->sourceFile, ctx->config->options->GetCompilationMode() == CompilationMode::GEN_STD_LIB); } - ctx->state = !ctx->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_PARSED : ES2PANDA_STATE_ERROR; - if (ctx->state == ES2PANDA_STATE_ERROR) { - ctx->diagnosticEngine->FlushDiagnostic(); - } + ctx->state = ES2PANDA_STATE_PARSED; ctx->phaseManager->SetCurrentPhaseIdToAfterParse(); return ctx; } @@ -535,7 +532,6 @@ __attribute__((unused)) static Context *Check(Context *ctx) } if (ctx->state == ES2PANDA_STATE_ERROR) { - ctx->diagnosticEngine->FlushDiagnostic(); return ctx; } @@ -579,7 +575,6 @@ __attribute__((unused)) static Context *Lower(Context *ctx) } if (ctx->state == ES2PANDA_STATE_ERROR) { - ctx->diagnosticEngine->FlushDiagnostic(); return ctx; } @@ -688,9 +683,6 @@ extern "C" __attribute__((unused)) es2panda_Context *ProceedToState(es2panda_Con break; } - if (ctx->state == ES2PANDA_STATE_ERROR) { - ctx->diagnosticEngine->FlushDiagnostic(); - } return reinterpret_cast(ctx); } diff --git a/ets2panda/test/unit/public/ast_verifier_check_struct_declaration_test.cpp b/ets2panda/test/unit/public/ast_verifier_check_struct_declaration_test.cpp index dbdd1b433c..288cafaf20 100644 --- a/ets2panda/test/unit/public/ast_verifier_check_struct_declaration_test.cpp +++ b/ets2panda/test/unit/public/ast_verifier_check_struct_declaration_test.cpp @@ -163,7 +163,7 @@ TEST_F(ASTVerifierTest, StructInStruct) } )"; - CONTEXT(ES2PANDA_STATE_PARSED, ES2PANDA_STATE_ERROR, text) + CONTEXT(ES2PANDA_STATE_PARSED, text) { ASSERT_TRUE(GetImpl()->IsAnyError(GetContext())); } -- Gitee