From 5f065d39b1518dd7c76bd1567d66c5808a93caab Mon Sep 17 00:00:00 2001 From: dongchao Date: Mon, 25 Aug 2025 11:00:33 +0800 Subject: [PATCH] Generate toplevel arkui annotation Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICVCOM Signed-off-by: dongchao Change-Id: Ie6a9aef2f3dee0702f8f60d5cce8e6e9dd8acb3e --- ets2panda/declgen_ets2ts/declgenEts2Ts.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp b/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp index 8c86341878..fa04785886 100644 --- a/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp +++ b/ets2panda/declgen_ets2ts/declgenEts2Ts.cpp @@ -1096,7 +1096,7 @@ std::string TSDeclGen::RemoveModuleExtensionName(const std::string &filepath) template void TSDeclGen::GenAnnotations(const T *node) { - if (node == nullptr) { + if (node == nullptr || (node->Annotations().size() == 0U)) { return; } GenSeparated( @@ -2275,6 +2275,7 @@ void TSDeclGen::GenMethodDeclaration(const ir::MethodDefinition *methodDef) if (ShouldSkipMethodDeclaration(methodDef)) { return; } + GenAnnotations(methodDef->Function()); const auto methodIdent = GetKeyIdent(methodDef->Key()); auto methodName = methodIdent->Name().Mutf8(); if (methodName.compare("$_iterator") == 0) { @@ -2313,10 +2314,6 @@ bool TSDeclGen::GenMethodDeclarationPrefix(const ir::MethodDefinition *methodDef !ShouldEmitDeclarationSymbol(methodIdent) && !methodDef->IsConstructor()) { return true; } - auto methDefFunc = methodDef->Function(); - if (methDefFunc != nullptr && !methDefFunc->Annotations().empty()) { - GenAnnotations(methDefFunc); - } ProcessIndent(); GenModifier(methodDef); } -- Gitee