// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. part of '../api.dart'; /// The marker interface for all types of macros. abstract interface class Macro {} /// The interface for [Macro]s that can be applied to a library directive, and /// want to contribute new type declarations to the library. abstract interface class LibraryTypesMacro implements Macro { FutureOr buildTypesForLibrary(Library library, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to a library directive, and /// want to contribute new non-type declarations to the library. abstract interface class LibraryDeclarationsMacro implements Macro { FutureOr buildDeclarationsForLibrary( Library library, DeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to a library directive, and /// want to provide definitions for declarations in the library. abstract interface class LibraryDefinitionMacro implements Macro { FutureOr buildDefinitionForLibrary( Library library, LibraryDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any top level function, /// instance method, or static method, and want to contribute new type /// declarations to the program. abstract interface class FunctionTypesMacro implements Macro { FutureOr buildTypesForFunction( FunctionDeclaration function, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any top level function, /// instance method, or static method, and want to contribute new non-type /// declarations to the program. abstract interface class FunctionDeclarationsMacro implements Macro { FutureOr buildDeclarationsForFunction( FunctionDeclaration function, DeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any top level function, /// instance method, or static method, and want to augment the function /// definition. abstract interface class FunctionDefinitionMacro implements Macro { FutureOr buildDefinitionForFunction( FunctionDeclaration function, FunctionDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any top level variable or /// instance field, and want to contribute new type declarations to the /// program. abstract interface class VariableTypesMacro implements Macro { FutureOr buildTypesForVariable( VariableDeclaration variable, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any top level variable or /// instance field and want to contribute new non-type declarations to the /// program. abstract interface class VariableDeclarationsMacro implements Macro { FutureOr buildDeclarationsForVariable( VariableDeclaration variable, DeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any top level variable /// or instance field, and want to augment the variable definition. abstract interface class VariableDefinitionMacro implements Macro { FutureOr buildDefinitionForVariable( VariableDeclaration variable, VariableDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any class, and want to /// contribute new type declarations to the program. abstract interface class ClassTypesMacro implements Macro { FutureOr buildTypesForClass( ClassDeclaration clazz, ClassTypeBuilder builder); } /// The interface for [Macro]s that can be applied to any class, and want to /// contribute new non-type declarations to the program. abstract interface class ClassDeclarationsMacro implements Macro { FutureOr buildDeclarationsForClass( ClassDeclaration clazz, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any class, and want to /// augment the definitions of the members of that class. abstract interface class ClassDefinitionMacro implements Macro { FutureOr buildDefinitionForClass( ClassDeclaration clazz, TypeDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// contribute new type declarations to the program. abstract interface class EnumTypesMacro implements Macro { FutureOr buildTypesForEnum( EnumDeclaration enuum, EnumTypeBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// contribute new non-type declarations to the program. abstract interface class EnumDeclarationsMacro implements Macro { FutureOr buildDeclarationsForEnum( EnumDeclaration enuum, EnumDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// augment the definitions of members or values of that enum. abstract interface class EnumDefinitionMacro implements Macro { FutureOr buildDefinitionForEnum( EnumDeclaration enuum, EnumDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// contribute new type declarations to the program. abstract interface class EnumValueTypesMacro implements Macro { FutureOr buildTypesForEnumValue( EnumValueDeclaration entry, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// contribute new non-type declarations to the program. abstract interface class EnumValueDeclarationsMacro implements Macro { FutureOr buildDeclarationsForEnumValue( EnumValueDeclaration entry, EnumDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any enum, and want to /// augment the definitions of members or values of that enum. abstract interface class EnumValueDefinitionMacro implements Macro { FutureOr buildDefinitionForEnumValue( EnumValueDeclaration entry, EnumValueDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any field, and want to /// contribute new type declarations to the program. abstract interface class FieldTypesMacro implements Macro { FutureOr buildTypesForField( FieldDeclaration field, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any field, and want to /// contribute new type declarations to the program. abstract interface class FieldDeclarationsMacro implements Macro { FutureOr buildDeclarationsForField( FieldDeclaration field, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any field, and want to /// augment the field definition. abstract interface class FieldDefinitionMacro implements Macro { FutureOr buildDefinitionForField( FieldDeclaration field, VariableDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any method, and want to /// contribute new type declarations to the program. abstract interface class MethodTypesMacro implements Macro { FutureOr buildTypesForMethod( MethodDeclaration method, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any method, and want to /// contribute new non-type declarations to the program. abstract interface class MethodDeclarationsMacro implements Macro { FutureOr buildDeclarationsForMethod( MethodDeclaration method, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any method, and want to /// augment the function definition. abstract interface class MethodDefinitionMacro implements Macro { FutureOr buildDefinitionForMethod( MethodDeclaration method, FunctionDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any constructor, and want /// to contribute new type declarations to the program. abstract interface class ConstructorTypesMacro implements Macro { FutureOr buildTypesForConstructor( ConstructorDeclaration constructor, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any constructors, and /// want to contribute new non-type declarations to the program. abstract interface class ConstructorDeclarationsMacro implements Macro { FutureOr buildDeclarationsForConstructor( ConstructorDeclaration constructor, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any constructor, and want /// to augment the function definition. abstract interface class ConstructorDefinitionMacro implements Macro { FutureOr buildDefinitionForConstructor( ConstructorDeclaration constructor, ConstructorDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any mixin declaration, and /// want to contribute new type declarations to the program. abstract interface class MixinTypesMacro implements Macro { FutureOr buildTypesForMixin( MixinDeclaration mixin, MixinTypeBuilder builder); } /// The interface for [Macro]s that can be applied to any mixin declaration, and /// want to contribute new non-type declarations to the program. abstract interface class MixinDeclarationsMacro implements Macro { FutureOr buildDeclarationsForMixin( MixinDeclaration mixin, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any mixin declaration, and /// want to augment the definitions of the members of that mixin. abstract interface class MixinDefinitionMacro implements Macro { FutureOr buildDefinitionForMixin( MixinDeclaration mixin, TypeDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any extension declaration, /// and want to contribute new type declarations to the program. abstract interface class ExtensionTypesMacro implements Macro { FutureOr buildTypesForExtension( ExtensionDeclaration extension, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any extension declaration, /// and want to contribute new non-type declarations to the program. abstract interface class ExtensionDeclarationsMacro implements Macro { FutureOr buildDeclarationsForExtension( ExtensionDeclaration extension, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any extension declaration, /// and want to augment the definitions of the members of that extension. abstract interface class ExtensionDefinitionMacro implements Macro { FutureOr buildDefinitionForExtension( ExtensionDeclaration extension, TypeDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any extension type /// declaration, and want to contribute new type declarations to the program. abstract interface class ExtensionTypeTypesMacro implements Macro { FutureOr buildTypesForExtensionType( ExtensionTypeDeclaration extension, TypeBuilder builder); } /// The interface for [Macro]s that can be applied to any extension type /// declaration, and want to contribute new non-type declarations to the /// program. abstract interface class ExtensionTypeDeclarationsMacro implements Macro { FutureOr buildDeclarationsForExtensionType( ExtensionTypeDeclaration extension, MemberDeclarationBuilder builder); } /// The interface for [Macro]s that can be applied to any extension type /// declaration, and want to augment the definitions of the members of that /// extension. abstract interface class ExtensionTypeDefinitionMacro implements Macro { FutureOr buildDefinitionForExtensionType( ExtensionTypeDeclaration extension, TypeDefinitionBuilder builder); } /// The interface for [Macro]s that can be applied to any type alias /// declaration, and want to contribute new type declarations to the program. abstract interface class TypeAliasTypesMacro implements Macro { FutureOr buildTypesForTypeAlias( TypeAliasDeclaration declaration, TypeBuilder builder, ); } /// The interface for [Macro]s that can be applied to any type alias /// declaration, and want to contribute new non-type declarations to the /// program. abstract interface class TypeAliasDeclarationsMacro implements Macro { FutureOr buildDeclarationsForTypeAlias( TypeAliasDeclaration declaration, DeclarationBuilder builder, ); }