From fccecc60ad0c3555be6c89b756e1d44e9190d8c3 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Fri, 13 Sep 2024 20:19:36 +0000 Subject: [PATCH] update to the latest macro APIs --- .../example/benchmark/src/data_class.dart | 1 + .../benchmark/src/functional_widget.dart | 52 ++-- .../example/benchmark/src/injectable.dart | 289 ++++++++++-------- .../benchmark/src/json_serializable.dart | 26 +- 4 files changed, 199 insertions(+), 169 deletions(-) diff --git a/working/macros/example/benchmark/src/data_class.dart b/working/macros/example/benchmark/src/data_class.dart index 637ef713a..03824e56a 100644 --- a/working/macros/example/benchmark/src/data_class.dart +++ b/working/macros/example/benchmark/src/data_class.dart @@ -235,6 +235,7 @@ final myClassMethods = [ identifier: objectIdentifier, isNullable: false, typeArguments: const []), + style: ParameterStyle.normal, ) ], returnType: boolType, diff --git a/working/macros/example/benchmark/src/functional_widget.dart b/working/macros/example/benchmark/src/functional_widget.dart index 6bb4c8f5a..c07389e5a 100644 --- a/working/macros/example/benchmark/src/functional_widget.dart +++ b/working/macros/example/benchmark/src/functional_widget.dart @@ -94,34 +94,38 @@ final myFunction = FunctionDeclarationImpl( isSetter: false, namedParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'title'), - isNamed: true, - isRequired: true, - library: fooLibrary, - metadata: [], - type: stringType), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'title'), + isNamed: true, + isRequired: true, + library: fooLibrary, + metadata: [], + type: stringType, + style: ParameterStyle.normal, + ), ], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'context'), - isNamed: false, - isRequired: true, - library: fooLibrary, - metadata: [], - type: buildContextType), + id: RemoteInstance.uniqueId, + identifier: + IdentifierImpl(id: RemoteInstance.uniqueId, name: 'context'), + isNamed: false, + isRequired: true, + library: fooLibrary, + metadata: [], + type: buildContextType, + style: ParameterStyle.normal, + ), FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'count'), - isNamed: false, - isRequired: true, - library: fooLibrary, - metadata: [], - type: intType), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'count'), + isNamed: false, + isRequired: true, + library: fooLibrary, + metadata: [], + type: intType, + style: ParameterStyle.normal, + ), ], returnType: widgetType, typeParameters: []); diff --git a/working/macros/example/benchmark/src/injectable.dart b/working/macros/example/benchmark/src/injectable.dart index ad4b2162a..4e8c1179c 100644 --- a/working/macros/example/benchmark/src/injectable.dart +++ b/working/macros/example/benchmark/src/injectable.dart @@ -357,6 +357,7 @@ final electricHeaterConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: ''), + isConst: false, library: fooLibrary, metadata: [], hasBody: true, @@ -477,6 +478,7 @@ final thermosiphonConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: ''), + isConst: false, library: fooLibrary, metadata: [], hasBody: true, @@ -492,6 +494,7 @@ final thermosiphonConstructors = [ isNamed: false, isRequired: true, type: field.type, + style: ParameterStyle.normal, ), ], returnType: NamedTypeAnnotationImpl( @@ -520,24 +523,26 @@ final generatedThermosiphonMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'heaterProvider'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: providerIdentifier, - typeArguments: [ - NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: heaterIdentifier, - typeArguments: []), - ])) + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl( + id: RemoteInstance.uniqueId, name: 'heaterProvider'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: providerIdentifier, + typeArguments: [ + NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: heaterIdentifier, + typeArguments: []), + ]), + style: ParameterStyle.normal, + ) ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -622,6 +627,7 @@ final coffeeMakerConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: ''), + isConst: false, library: fooLibrary, metadata: [], hasBody: true, @@ -637,6 +643,7 @@ final coffeeMakerConstructors = [ isNamed: false, isRequired: true, type: field.type, + style: ParameterStyle.normal, ), ], returnType: NamedTypeAnnotationImpl( @@ -667,43 +674,47 @@ final generatedCoffeeMakerMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'heaterProvider'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: providerIdentifier, - typeArguments: [ - NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: heaterIdentifier, - typeArguments: []) - ])), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl( + id: RemoteInstance.uniqueId, name: 'heaterProvider'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: providerIdentifier, + typeArguments: [ + NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: heaterIdentifier, + typeArguments: []) + ]), + style: ParameterStyle.normal, + ), FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'pumpProvider'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: providerIdentifier, - typeArguments: [ - NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: pumpIdentifier, - typeArguments: []) - ])), + id: RemoteInstance.uniqueId, + identifier: + IdentifierImpl(id: RemoteInstance.uniqueId, name: 'pumpProvider'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: providerIdentifier, + typeArguments: [ + NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: pumpIdentifier, + typeArguments: []) + ]), + style: ParameterStyle.normal, + ), ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -760,18 +771,19 @@ final dripCoffeeModuleMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'impl'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: electricHeaterIdentifier, - typeArguments: [])), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'impl'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: electricHeaterIdentifier, + typeArguments: []), + style: ParameterStyle.normal, + ), ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -795,18 +807,19 @@ final dripCoffeeModuleMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'impl'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: thermosiphonIdentifier, - typeArguments: [])), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'impl'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: thermosiphonIdentifier, + typeArguments: []), + style: ParameterStyle.normal, + ), ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -837,24 +850,26 @@ final generatedDripCoffeeModuleMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'provideImpl'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: providerIdentifier, - typeArguments: [ - NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: electricHeaterIdentifier, - typeArguments: []) - ])) + id: RemoteInstance.uniqueId, + identifier: + IdentifierImpl(id: RemoteInstance.uniqueId, name: 'provideImpl'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: providerIdentifier, + typeArguments: [ + NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: electricHeaterIdentifier, + typeArguments: []) + ]), + style: ParameterStyle.normal, + ) ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -884,24 +899,26 @@ final generatedDripCoffeeModuleMethods = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'provideImpl'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: providerIdentifier, - typeArguments: [ - NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: thermosiphonIdentifier, - typeArguments: []) - ])) + id: RemoteInstance.uniqueId, + identifier: + IdentifierImpl(id: RemoteInstance.uniqueId, name: 'provideImpl'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: providerIdentifier, + typeArguments: [ + NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: thermosiphonIdentifier, + typeArguments: []) + ]), + style: ParameterStyle.normal, + ) ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -972,6 +989,7 @@ final dripCoffeeComponentConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: ''), + isConst: false, library: fooLibrary, metadata: [], hasBody: true, @@ -979,18 +997,20 @@ final dripCoffeeComponentConstructors = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: IdentifierImpl( - id: RemoteInstance.uniqueId, name: 'dripCoffeeModule'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: dripCoffeeModuleIdentifier, - typeArguments: [])), + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl( + id: RemoteInstance.uniqueId, name: 'dripCoffeeModule'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: dripCoffeeModuleIdentifier, + typeArguments: []), + style: ParameterStyle.normal, + ), ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, @@ -1008,6 +1028,7 @@ final generatedDripCoffeeComponentConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: '_'), + isConst: false, library: fooLibrary, metadata: [], hasBody: true, @@ -1015,13 +1036,15 @@ final generatedDripCoffeeComponentConstructors = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: generatedDripCoffeeComponentFields.first.identifier, - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: generatedDripCoffeeComponentFields.first.type), + id: RemoteInstance.uniqueId, + identifier: generatedDripCoffeeComponentFields.first.identifier, + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: generatedDripCoffeeComponentFields.first.type, + style: ParameterStyle.normal, + ), ], returnType: NamedTypeAnnotationImpl( id: RemoteInstance.uniqueId, diff --git a/working/macros/example/benchmark/src/json_serializable.dart b/working/macros/example/benchmark/src/json_serializable.dart index 21787a5dd..78fdb5089 100644 --- a/working/macros/example/benchmark/src/json_serializable.dart +++ b/working/macros/example/benchmark/src/json_serializable.dart @@ -227,6 +227,7 @@ final myClassConstructors = [ ConstructorDeclarationImpl( id: RemoteInstance.uniqueId, identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'fromJson'), + isConst: false, library: fooLibrary, metadata: [], hasBody: false, @@ -234,18 +235,19 @@ final myClassConstructors = [ namedParameters: [], positionalParameters: [ FormalParameterDeclarationImpl( - id: RemoteInstance.uniqueId, - identifier: - IdentifierImpl(id: RemoteInstance.uniqueId, name: 'json'), - library: fooLibrary, - metadata: [], - isNamed: false, - isRequired: true, - type: NamedTypeAnnotationImpl( - id: RemoteInstance.uniqueId, - isNullable: false, - identifier: mapIdentifier, - typeArguments: [stringType, dynamicType])) + id: RemoteInstance.uniqueId, + identifier: IdentifierImpl(id: RemoteInstance.uniqueId, name: 'json'), + library: fooLibrary, + metadata: [], + isNamed: false, + isRequired: true, + type: NamedTypeAnnotationImpl( + id: RemoteInstance.uniqueId, + isNullable: false, + identifier: mapIdentifier, + typeArguments: [stringType, dynamicType]), + style: ParameterStyle.normal, + ) ], returnType: myClassType, typeParameters: [],