diff --git a/ets2panda/compiler/core/ETSemitter.cpp b/ets2panda/compiler/core/ETSemitter.cpp index 71855bef27601abd5ed09716449966d169c24de7..d85a674db7e9e8cd55706817cb3fbc9a48eef056 100644 --- a/ets2panda/compiler/core/ETSemitter.cpp +++ b/ets2panda/compiler/core/ETSemitter.cpp @@ -958,7 +958,6 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationModule(const ir::ClassDefinitio pandasm::Type::FromName(cls->Definition()->InternalName().Utf8(), true))); } - GenAnnotationRecord(Signatures::ETS_ANNOTATION_MODULE); pandasm::AnnotationData moduleAnno(Signatures::ETS_ANNOTATION_MODULE); pandasm::AnnotationElement value( Signatures::ANNOTATION_KEY_EXPORTED, @@ -969,7 +968,6 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationModule(const ir::ClassDefinitio pandasm::AnnotationData ETSEmitter::GenAnnotationFunctionOverload(const ArenaVector &body) { - GenAnnotationRecord(Signatures::ETS_ANNOTATION_FUNCTION_OVERLOAD); pandasm::AnnotationData overloadAnno(Signatures::ETS_ANNOTATION_FUNCTION_OVERLOAD); for (auto *node : body) { @@ -993,46 +991,8 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationFunctionOverload(const ArenaVec return overloadAnno; } -pandasm::AnnotationData ETSEmitter::GenAnnotationSignature(const ir::ClassDefinition *classDef) -{ - std::vector parts {}; - const auto &typeParams = classDef->TypeParams()->Params(); - - auto const addStringValue = [&parts](std::string_view str) { - parts.emplace_back(pandasm::ScalarValue::Create(str)); - }; - - if (!typeParams.empty()) { - addStringValue(Signatures::GENERIC_BEGIN); - - for (const auto *param : typeParams) { - addStringValue(Signatures::MANGLE_BEGIN); - std::stringstream ss; - param->Constraint()->TsType()->ToAssemblerTypeWithRank(ss); - auto asmName = util::StringView(ss.str()); - addStringValue(checker::ETSObjectType::NameToDescriptor(asmName)); - } - addStringValue(Signatures::GENERIC_END); - } - - if (auto super = classDef->TsType()->AsETSObjectType()->SuperType(); super != nullptr) { - addStringValue(checker::ETSObjectType::NameToDescriptor(util::StringView(super->AssemblerName().Mutf8()))); - } else { - addStringValue(checker::ETSObjectType::NameToDescriptor(Signatures::BUILTIN_OBJECT)); - } - - GenAnnotationRecord(Signatures::ETS_ANNOTATION_SIGNATURE); - pandasm::AnnotationData signature(Signatures::ETS_ANNOTATION_SIGNATURE); - pandasm::AnnotationElement value( - Signatures::ANNOTATION_KEY_VALUE, - std::make_unique(pandasm::Value::Type::STRING, std::move(parts))); - signature.AddElement(std::move(value)); - return signature; -} - pandasm::AnnotationData ETSEmitter::GenAnnotationEnclosingMethod(const ir::MethodDefinition *methodDef) { - GenAnnotationRecord(Signatures::ETS_ANNOTATION_ENCLOSING_METHOD); pandasm::AnnotationData enclosingMethod(Signatures::ETS_ANNOTATION_ENCLOSING_METHOD); ES2PANDA_ASSERT(methodDef->Function() != nullptr); pandasm::AnnotationElement value( @@ -1045,7 +1005,6 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationEnclosingMethod(const ir::Metho pandasm::AnnotationData ETSEmitter::GenAnnotationFunctionalReference(const ir::ClassDefinition *classDef) { - GenAnnotationRecord(Signatures::ETS_ANNOTATION_FUNCTIONAL_REFERENCE); pandasm::AnnotationData functionalReference(Signatures::ETS_ANNOTATION_FUNCTIONAL_REFERENCE); bool isStatic = classDef->FunctionalReferenceReferencedMethod()->IsStatic(); ES2PANDA_ASSERT(const_cast(classDef) != nullptr); @@ -1065,7 +1024,6 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationFunctionalReference(const ir::C pandasm::AnnotationData ETSEmitter::GenAnnotationEnclosingClass(std::string_view className) { - GenAnnotationRecord(Signatures::ETS_ANNOTATION_ENCLOSING_CLASS); pandasm::AnnotationData enclosingClass(Signatures::ETS_ANNOTATION_ENCLOSING_CLASS); pandasm::AnnotationElement value( Signatures::ANNOTATION_KEY_VALUE, @@ -1078,7 +1036,6 @@ pandasm::AnnotationData ETSEmitter::GenAnnotationEnclosingClass(std::string_view pandasm::AnnotationData ETSEmitter::GenAnnotationInnerClass(const ir::ClassDefinition *classDef, const ir::AstNode *parent) { - GenAnnotationRecord(Signatures::ETS_ANNOTATION_INNER_CLASS); pandasm::AnnotationData innerClass(Signatures::ETS_ANNOTATION_INNER_CLASS); const bool isAnonymous = (classDef->Modifiers() & ir::ClassDefinitionModifiers::ANONYMOUS) != 0; pandasm::AnnotationElement name(Signatures::ANNOTATION_KEY_NAME, diff --git a/ets2panda/compiler/core/ETSemitter.h b/ets2panda/compiler/core/ETSemitter.h index 084964321b2986866214b96a02f85535201b31db..16738c9df5509c75f6d8471e570650d9cc14cbd3 100644 --- a/ets2panda/compiler/core/ETSemitter.h +++ b/ets2panda/compiler/core/ETSemitter.h @@ -108,7 +108,6 @@ private: void GenInterfaceMethodDefinition(const ir::MethodDefinition *methodDef, bool external); void GenClassInheritedFields(const checker::ETSObjectType *baseType, pandasm::Record &classRecord); - pandasm::AnnotationData GenAnnotationSignature(const ir::ClassDefinition *classDef); pandasm::AnnotationData GenAnnotationModule(const ir::ClassDefinition *classDef); pandasm::AnnotationData GenAnnotationFunctionOverload(const ArenaVector &body); pandasm::AnnotationData GenAnnotationEnclosingClass(std::string_view className); diff --git a/ets2panda/compiler/scripts/signatures.yaml b/ets2panda/compiler/scripts/signatures.yaml index 2f938ace7cb7e9e06b9c448fc262c7c58e95e6ef..1d240e1388b23fd43f51e91c4459c31b4182ebea 100644 --- a/ets2panda/compiler/scripts/signatures.yaml +++ b/ets2panda/compiler/scripts/signatures.yaml @@ -32,7 +32,7 @@ defines: ref: SET_INDEX_METHOD - name: $_iterator ref: ITERATOR_METHOD - - name: Iterator + - name: Iterator ref: ITERATOR_CLASS - name: 'ambient_indexer' ref: AMBIENT_INDEXER @@ -91,25 +91,25 @@ defines: - name: runtime_type ref: RUNTIME_TYPE_ANNOTATION comment: Annotation retention type - - name: ets/annotation/InnerClass + - name: std.annotations.InnerClass ref: ETS_ANNOTATION_INNER_CLASS comment: Ets record - - name: ets/annotation/EnclosingClass + - name: std.annotations.EnclosingClass ref: ETS_ANNOTATION_ENCLOSING_CLASS comment: Ets record - - name: ets/annotation/EnclosingMethod + - name: std.annotations.EnclosingMethod ref: ETS_ANNOTATION_ENCLOSING_METHOD comment: Ets record - name: ets/annotation/Signature ref: ETS_ANNOTATION_SIGNATURE comment: Ets record - - name: ets/annotation/Module + - name: std.annotations.Module ref: ETS_ANNOTATION_MODULE comment: Ets record - - name: ets/annotation/FunctionalReference + - name: std.annotations.FunctionalReference ref: ETS_ANNOTATION_FUNCTIONAL_REFERENCE comment: Ets record - - name: ets/annotation/FunctionOverload + - name: std.annotations.FunctionOverload ref: ETS_ANNOTATION_FUNCTION_OVERLOAD comment: Ets record - name: ets/coroutine/Async