From f46aa56afef46b6c611e01f9ddc71488b0e8814c Mon Sep 17 00:00:00 2001 From: Johnni Winther Date: Wed, 23 Oct 2024 08:49:23 +0000 Subject: [PATCH] [cfe] Remove unused properties from BodyBuilderContext Change-Id: I75f6a3cdf63b32555ae96f181f99bfaec1de5e56 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391403 Reviewed-by: Chloe Stefantsova Commit-Queue: Johnni Winther --- pkg/front_end/lib/src/base/scope.dart | 5 +- .../src/builder/formal_parameter_builder.dart | 7 +- .../lib/src/fragment/constructor.dart | 10 +- pkg/front_end/lib/src/fragment/factory.dart | 10 +- pkg/front_end/lib/src/fragment/function.dart | 5 +- pkg/front_end/lib/src/fragment/getter.dart | 10 +- pkg/front_end/lib/src/fragment/method.dart | 10 +- .../lib/src/fragment/primary_constructor.dart | 10 +- pkg/front_end/lib/src/fragment/setter.dart | 10 +- .../lib/src/kernel/body_builder_context.dart | 226 +++--------------- .../lib/src/kernel/implicit_field_type.dart | 5 +- .../lib/src/source/diet_listener.dart | 79 ++---- .../lib/src/source/source_builder_mixins.dart | 15 +- .../lib/src/source/source_class_builder.dart | 25 +- .../source/source_constructor_builder.dart | 40 +--- .../lib/src/source/source_enum_builder.dart | 18 +- .../src/source/source_extension_builder.dart | 15 +- ...ce_extension_type_declaration_builder.dart | 15 +- .../src/source/source_factory_builder.dart | 30 +-- .../lib/src/source/source_field_builder.dart | 23 +- .../src/source/source_function_builder.dart | 17 +- .../src/source/source_library_builder.dart | 20 +- .../lib/src/source/source_loader.dart | 5 +- .../lib/src/source/source_member_builder.dart | 10 +- .../src/source/source_procedure_builder.dart | 10 +- .../src/source/source_type_alias_builder.dart | 20 +- .../test/fasta/generator_to_string_test.dart | 5 +- 27 files changed, 118 insertions(+), 537 deletions(-) diff --git a/pkg/front_end/lib/src/base/scope.dart b/pkg/front_end/lib/src/base/scope.dart index 424baf519bd0..62072d478793 100644 --- a/pkg/front_end/lib/src/base/scope.dart +++ b/pkg/front_end/lib/src/base/scope.dart @@ -764,10 +764,7 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + BodyBuilderContext createBodyBuilderContext() { throw new UnsupportedError( '$runtimeType.bodyBuilderContextForAnnotations}'); } diff --git a/pkg/front_end/lib/src/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/builder/formal_parameter_builder.dart index c0b046add3e6..3b69de44303a 100644 --- a/pkg/front_end/lib/src/builder/formal_parameter_builder.dart +++ b/pkg/front_end/lib/src/builder/formal_parameter_builder.dart @@ -276,11 +276,8 @@ class FormalParameterBuilder extends BuilderImpl final DeclarationBuilder declarationBuilder = parent.declarationBuilder!; LookupScope scope = declarationBuilder.scope; - BodyBuilderContext bodyBuilderContext = new ParameterBodyBuilderContext( - this, - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false); + BodyBuilderContext bodyBuilderContext = + new ParameterBodyBuilderContext(this); BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( libraryBuilder, bodyBuilderContext, scope, fileUri); diff --git a/pkg/front_end/lib/src/fragment/constructor.dart b/pkg/front_end/lib/src/fragment/constructor.dart index b4331a94cf6c..a06135a13f41 100644 --- a/pkg/front_end/lib/src/fragment/constructor.dart +++ b/pkg/front_end/lib/src/fragment/constructor.dart @@ -99,14 +99,8 @@ class _ConstructorBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/factory.dart b/pkg/front_end/lib/src/fragment/factory.dart index 44cad93f6444..04439fb53e0f 100644 --- a/pkg/front_end/lib/src/fragment/factory.dart +++ b/pkg/front_end/lib/src/fragment/factory.dart @@ -83,14 +83,8 @@ class _FactoryBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/function.dart b/pkg/front_end/lib/src/fragment/function.dart index 7fdb21d97376..f1036fb4aa7f 100644 --- a/pkg/front_end/lib/src/fragment/function.dart +++ b/pkg/front_end/lib/src/fragment/function.dart @@ -18,10 +18,7 @@ abstract class FunctionBodyBuildingContext { // TODO(johnniwinther): Avoid the need for this. bool get shouldBuild; - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); LookupScope get typeParameterScope; diff --git a/pkg/front_end/lib/src/fragment/getter.dart b/pkg/front_end/lib/src/fragment/getter.dart index 36448df459cb..d25cf9e42f0b 100644 --- a/pkg/front_end/lib/src/fragment/getter.dart +++ b/pkg/front_end/lib/src/fragment/getter.dart @@ -86,14 +86,8 @@ class _GetterBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/method.dart b/pkg/front_end/lib/src/fragment/method.dart index 24389b16761c..47c0c1508f23 100644 --- a/pkg/front_end/lib/src/fragment/method.dart +++ b/pkg/front_end/lib/src/fragment/method.dart @@ -88,14 +88,8 @@ class _MethodBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/primary_constructor.dart b/pkg/front_end/lib/src/fragment/primary_constructor.dart index 45d0a68cec84..c347f4152381 100644 --- a/pkg/front_end/lib/src/fragment/primary_constructor.dart +++ b/pkg/front_end/lib/src/fragment/primary_constructor.dart @@ -91,14 +91,8 @@ class _PrimaryConstructorBodyBuildingContext } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/setter.dart b/pkg/front_end/lib/src/fragment/setter.dart index 57bad9ae2785..944d2e73225c 100644 --- a/pkg/front_end/lib/src/fragment/setter.dart +++ b/pkg/front_end/lib/src/fragment/setter.dart @@ -86,14 +86,8 @@ class _SetterBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/kernel/body_builder_context.dart b/pkg/front_end/lib/src/kernel/body_builder_context.dart index 7134351cccd3..95eae5fbde86 100644 --- a/pkg/front_end/lib/src/kernel/body_builder_context.dart +++ b/pkg/front_end/lib/src/kernel/body_builder_context.dart @@ -41,25 +41,15 @@ import 'internal_ast.dart'; abstract class BodyBuilderContext { final BodyBuilderDeclarationContext _declarationContext; - final bool isDeclarationInstanceMember; - - final bool inOutlineBuildingPhase; - - final bool inMetadata; - - final bool inConstFields; + final bool _isDeclarationInstanceMember; BodyBuilderContext( LibraryBuilder libraryBuilder, DeclarationBuilder? declarationBuilder, - {required this.isDeclarationInstanceMember, - required this.inOutlineBuildingPhase, - required this.inMetadata, - required this.inConstFields}) - : _declarationContext = new BodyBuilderDeclarationContext( + {required bool isDeclarationInstanceMember}) + : _isDeclarationInstanceMember = isDeclarationInstanceMember, + _declarationContext = new BodyBuilderDeclarationContext( libraryBuilder, declarationBuilder); - bool get hasFormalParameters; - String get memberName { throw new UnsupportedError('${runtimeType}.memberName'); } @@ -128,7 +118,7 @@ abstract class BodyBuilderContext { bool get isNativeMethod => false; bool get isDeclarationInstanceContext { - return isDeclarationInstanceMember || isConstructor; + return _isDeclarationInstanceMember || isConstructor; } bool get isRedirectingFactory => false; @@ -510,19 +500,8 @@ class _TopLevelBodyBuilderDeclarationContext } class LibraryBodyBuilderContext extends BodyBuilderContext { - LibraryBodyBuilderContext(SourceLibraryBuilder libraryBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) - : super(libraryBuilder, null, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + LibraryBodyBuilderContext(SourceLibraryBuilder libraryBuilder) + : super(libraryBuilder, null, isDeclarationInstanceMember: false); } mixin _DeclarationBodyBuilderContext @@ -535,89 +514,39 @@ mixin _DeclarationBodyBuilderContext class ClassBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - ClassBodyBuilderContext(SourceClassBuilder sourceClassBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ClassBodyBuilderContext(SourceClassBuilder sourceClassBuilder) : super(sourceClassBuilder.libraryBuilder, sourceClassBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class EnumBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - EnumBodyBuilderContext(SourceEnumBuilder sourceEnumBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + EnumBodyBuilderContext(SourceEnumBuilder sourceEnumBuilder) : super(sourceEnumBuilder.libraryBuilder, sourceEnumBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class ExtensionBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - ExtensionBodyBuilderContext(SourceExtensionBuilder sourceExtensionBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ExtensionBodyBuilderContext(SourceExtensionBuilder sourceExtensionBuilder) : super(sourceExtensionBuilder.libraryBuilder, sourceExtensionBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class ExtensionTypeBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { ExtensionTypeBodyBuilderContext( SourceExtensionTypeDeclarationBuilder - sourceExtensionTypeDeclarationBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + sourceExtensionTypeDeclarationBuilder) : super(sourceExtensionTypeDeclarationBuilder.libraryBuilder, sourceExtensionTypeDeclarationBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class TypedefBodyBuilderContext extends BodyBuilderContext { - TypedefBodyBuilderContext(SourceTypeAliasBuilder sourceTypeAliasBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + TypedefBodyBuilderContext(SourceTypeAliasBuilder sourceTypeAliasBuilder) : super(sourceTypeAliasBuilder.libraryBuilder, null, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } mixin _MemberBodyBuilderContext @@ -651,15 +580,9 @@ class FieldBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - FieldBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FieldBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool get isLateField => _member.isLate; @@ -687,10 +610,6 @@ class FieldBodyBuilderContext extends BodyBuilderContext ? ConstantContext.required : ConstantContext.none; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; } mixin _FunctionBodyBuilderContextMixin @@ -788,19 +707,9 @@ class ProcedureBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ProcedureBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ProcedureBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); } mixin _ConstructorBodyBuilderContextMixin @@ -872,15 +781,9 @@ class ConstructorBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ConstructorBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ConstructorBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool isConstructorCyclic(String name) { @@ -893,10 +796,6 @@ class ConstructorBodyBuilderContext extends BodyBuilderContext !isExternalConstructor; } - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; - @override TreeNode get _initializerParent => _member.invokeTarget; } @@ -912,25 +811,15 @@ class ExtensionTypeConstructorBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ExtensionTypeConstructorBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ExtensionTypeConstructorBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool isConstructorCyclic(String name) { return _declarationContext.isConstructorCyclic(_member.name, name); } - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; - @override TreeNode get _initializerParent => _member.invokeTarget; } @@ -945,15 +834,9 @@ class FactoryBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - FactoryBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FactoryBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override void setAsyncModifier(AsyncMarker asyncModifier) { @@ -964,10 +847,6 @@ class FactoryBodyBuilderContext extends BodyBuilderContext DartType get returnTypeContext { return _member.function.returnType; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; } class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext @@ -980,15 +859,9 @@ class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - RedirectingFactoryBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + RedirectingFactoryBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool get isRedirectingFactory => true; @@ -997,44 +870,24 @@ class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext String get redirectingFactoryTargetName { return _member.redirectionTarget.fullNameForErrors; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; } class ParameterBodyBuilderContext extends BodyBuilderContext { factory ParameterBodyBuilderContext( - FormalParameterBuilder formalParameterBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + FormalParameterBuilder formalParameterBuilder) { final DeclarationBuilder declarationBuilder = formalParameterBuilder.parent.declarationBuilder!; return new ParameterBodyBuilderContext._(declarationBuilder.libraryBuilder, - declarationBuilder, formalParameterBuilder, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + declarationBuilder, formalParameterBuilder); } ParameterBodyBuilderContext._( LibraryBuilder libraryBuilder, DeclarationBuilder? declarationBuilder, - FormalParameterBuilder formalParameterBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FormalParameterBuilder formalParameterBuilder) : super(libraryBuilder, declarationBuilder, isDeclarationInstanceMember: - formalParameterBuilder.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + formalParameterBuilder.isDeclarationInstanceMember); } // Coverage-ignore(suite): Not run. @@ -1048,16 +901,7 @@ class ExpressionCompilerProcedureBodyBuildContext extends BodyBuilderContext ExpressionCompilerProcedureBodyBuildContext( DietListener listener, this._member, this._builtMember, - {required bool isDeclarationInstanceMember, - required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + {required bool isDeclarationInstanceMember}) : super(listener.libraryBuilder, listener.currentDeclaration, - isDeclarationInstanceMember: isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - bool get hasFormalParameters => false; + isDeclarationInstanceMember: isDeclarationInstanceMember); } diff --git a/pkg/front_end/lib/src/kernel/implicit_field_type.dart b/pkg/front_end/lib/src/kernel/implicit_field_type.dart index 0df8aa9a3d4e..922ec0179622 100644 --- a/pkg/front_end/lib/src/kernel/implicit_field_type.dart +++ b/pkg/front_end/lib/src/kernel/implicit_field_type.dart @@ -150,10 +150,7 @@ class _ImplicitFieldTypeRoot extends InferredType { // Coverage-ignore(suite): Not run. ?.inferenceData); BodyBuilderContext bodyBuilderContext = - fieldBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + fieldBuilder.createBodyBuilderContext(); BodyBuilder bodyBuilder = fieldBuilder.libraryBuilder.loader .createBodyBuilderForField( fieldBuilder.libraryBuilder, diff --git a/pkg/front_end/lib/src/source/diet_listener.dart b/pkg/front_end/lib/src/source/diet_listener.dart index c885fba634ad..1682f5a27120 100644 --- a/pkg/front_end/lib/src/source/diet_listener.dart +++ b/pkg/front_end/lib/src/source/diet_listener.dart @@ -386,11 +386,8 @@ class DietListener extends StackListenerImpl { FunctionBodyBuildingContext functionBodyBuildingContext = functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { - final BodyBuilder listener = createFunctionListener( - functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + final BodyBuilder listener = + createFunctionListener(functionBodyBuildingContext); buildFunctionBody( listener, bodyToken, metadata, MemberKind.TopLevelMethod); } @@ -597,12 +594,7 @@ class DietListener extends StackListenerImpl { LibraryDependency? dependency = _offsetMap.lookupImport(importKeyword).libraryDependency; parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - dependency); + libraryBuilder.createBodyBuilderContext(), metadata, dependency); } @override @@ -618,12 +610,7 @@ class DietListener extends StackListenerImpl { LibraryDependency dependency = _offsetMap.lookupExport(exportKeyword).libraryDependency; parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - dependency); + libraryBuilder.createBodyBuilderContext(), metadata, dependency); } @override @@ -632,13 +619,7 @@ class DietListener extends StackListenerImpl { Token? metadata = pop() as Token?; LibraryPart part = _offsetMap.lookupPart(partKeyword); - parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - part); + parseMetadata(libraryBuilder.createBodyBuilderContext(), metadata, part); } @override @@ -691,14 +672,8 @@ class DietListener extends StackListenerImpl { buildRedirectingFactoryMethod(bodyToken, functionBodyBuildingContext, MemberKind.Factory, metadata); } else { - buildFunctionBody( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - bodyToken, - metadata, - MemberKind.Factory); + buildFunctionBody(createFunctionListener(functionBodyBuildingContext), + bodyToken, metadata, MemberKind.Factory); } } } @@ -833,14 +808,8 @@ class DietListener extends StackListenerImpl { functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { MemberKind memberKind = functionBodyBuildingContext.memberKind; - buildFunctionBody( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - beginParam, - metadata, - memberKind); + buildFunctionBody(createFunctionListener(functionBodyBuildingContext), + beginParam, metadata, memberKind); } } @@ -899,19 +868,13 @@ class DietListener extends StackListenerImpl { } BodyBuilder createFunctionListener( - FunctionBodyBuildingContext functionBodyBuildingContext, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + FunctionBodyBuildingContext functionBodyBuildingContext) { final LookupScope typeParameterScope = functionBodyBuildingContext.typeParameterScope; final LocalScope formalParameterScope = functionBodyBuildingContext .computeFormalParameterScope(typeParameterScope); return createListener( - functionBodyBuildingContext.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields), + functionBodyBuildingContext.createBodyBuilderContext(), typeParameterScope, thisVariable: functionBodyBuildingContext.thisVariable, thisTypeParameters: functionBodyBuildingContext.thisTypeParameters, @@ -929,11 +892,8 @@ class DietListener extends StackListenerImpl { // Coverage-ignore(suite): Not run. ?.beginSubdivide( BenchmarkSubdivides.diet_listener_buildRedirectingFactoryMethod); - final BodyBuilder listener = createFunctionListener( - functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + final BodyBuilder listener = + createFunctionListener(functionBodyBuildingContext); try { Parser parser = new Parser(listener, useImplicitCreationExpression: useImplicitCreationExpressionInCfe, @@ -978,12 +938,7 @@ class DietListener extends StackListenerImpl { // TODO(paulberry): don't re-parse the field if we've already parsed it // for type inference. _parseFields( - createListener( - declaration.createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: declaration.isConst), - memberScope, + createListener(declaration.createBodyBuilderContext(), memberScope, inferenceDataForTesting: declaration .dataForTesting // Coverage-ignore(suite): Not run. @@ -1146,11 +1101,7 @@ class DietListener extends StackListenerImpl { functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { buildPrimaryConstructor( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - formalsToken); + createFunctionListener(functionBodyBuildingContext), formalsToken); } // The current declaration is set in [beginClassOrMixinOrExtensionBody], diff --git a/pkg/front_end/lib/src/source/source_builder_mixins.dart b/pkg/front_end/lib/src/source/source_builder_mixins.dart index 7646099ac692..81867d642255 100644 --- a/pkg/front_end/lib/src/source/source_builder_mixins.dart +++ b/pkg/front_end/lib/src/source/source_builder_mixins.dart @@ -187,23 +187,14 @@ mixin SourceDeclarationBuilderMixin }); } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); void buildOutlineExpressions(ClassHierarchy classHierarchy, List delayedDefaultValueCloners) { if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { - typeParameters![i].buildOutlineExpressions( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - classHierarchy, - typeParameterScope); + typeParameters![i].buildOutlineExpressions(libraryBuilder, + createBodyBuilderContext(), classHierarchy, typeParameterScope); } } diff --git a/pkg/front_end/lib/src/source/source_class_builder.dart b/pkg/front_end/lib/src/source/source_class_builder.dart index 6ab35e7c721e..ea410af4cc01 100644 --- a/pkg/front_end/lib/src/source/source_class_builder.dart +++ b/pkg/front_end/lib/src/source/source_class_builder.dart @@ -411,14 +411,8 @@ class SourceClassBuilder extends ClassBuilderImpl return cls; } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ClassBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ClassBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -432,24 +426,15 @@ class SourceClassBuilder extends ClassBuilderImpl MetadataBuilder.buildAnnotations( isAugmenting ? origin.cls : cls, metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, libraryBuilder.scope, createFileUriExpression: isAugmenting); if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { - typeParameters![i].buildOutlineExpressions( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - classHierarchy, - typeParameterScope); + typeParameters![i].buildOutlineExpressions(libraryBuilder, + createBodyBuilderContext(), classHierarchy, typeParameterScope); } } diff --git a/pkg/front_end/lib/src/source/source_constructor_builder.dart b/pkg/front_end/lib/src/source/source_constructor_builder.dart index d90ac8c49b49..c1581c64993c 100644 --- a/pkg/front_end/lib/src/source/source_constructor_builder.dart +++ b/pkg/front_end/lib/src/source/source_constructor_builder.dart @@ -314,14 +314,8 @@ abstract class AbstractSourceConstructorBuilder formalParameterScope = null; } BodyBuilder bodyBuilder = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - declarationScope, - fileUri, + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationScope, fileUri, formalParameterScope: formalParameterScope); if (isConst) { bodyBuilder.constantContext = ConstantContext.required; @@ -664,14 +658,8 @@ class DeclaredSourceConstructorBuilder List? initializers; if (beginInitializers != null) { BodyBuilder bodyBuilder = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - declarationBuilder.scope, - fileUri); + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationBuilder.scope, fileUri); if (isConst) { bodyBuilder.constantContext = ConstantContext.required; } @@ -1014,14 +1002,8 @@ class DeclaredSourceConstructorBuilder } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ConstructorBodyBuilderContext(this, constructor, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ConstructorBodyBuilderContext(this, constructor); } // TODO(johnniwinther): Add annotations to tear-offs. @@ -1531,14 +1513,8 @@ class SourceExtensionTypeConstructorBuilder } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionTypeConstructorBodyBuilderContext(this, _constructor, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionTypeConstructorBodyBuilderContext(this, _constructor); } // TODO(johnniwinther): Add annotations to tear-offs. diff --git a/pkg/front_end/lib/src/source/source_enum_builder.dart b/pkg/front_end/lib/src/source/source_enum_builder.dart index 8d2eeae20c21..b6eeeb989f1a 100644 --- a/pkg/front_end/lib/src/source/source_enum_builder.dart +++ b/pkg/front_end/lib/src/source/source_enum_builder.dart @@ -574,14 +574,8 @@ class SourceEnumBuilder extends SourceClassBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new EnumBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new EnumBodyBuilderContext(this); } DartType buildElement(SourceFieldBuilder fieldBuilder, CoreTypes coreTypes) { @@ -643,13 +637,7 @@ class SourceEnumBuilder extends SourceClassBuilder { // be built via a body builder to detect potential errors. BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - scope, - fileUri); + libraryBuilder, createBodyBuilderContext(), scope, fileUri); bodyBuilder.constantContext = ConstantContext.inferred; if (enumConstantInfo.argumentsBeginToken != null) { diff --git a/pkg/front_end/lib/src/source/source_extension_builder.dart b/pkg/front_end/lib/src/source/source_extension_builder.dart index 1a2e15ab814d..7e43fd8f2fc2 100644 --- a/pkg/front_end/lib/src/source/source_extension_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_builder.dart @@ -184,14 +184,8 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionBodyBuilderContext(this); } @override @@ -219,10 +213,7 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl MetadataBuilder.buildAnnotations( annotatable, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, _introductory.fileUri, libraryBuilder.scope); diff --git a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart index f4e529f76f21..c281084a0fa8 100644 --- a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart @@ -730,10 +730,7 @@ class SourceExtensionTypeDeclarationBuilder MetadataBuilder.buildAnnotations( annotatable, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, _introductory.fileUri, libraryBuilder.scope); @@ -932,14 +929,8 @@ class SourceExtensionTypeDeclarationBuilder bool get isMixinDeclaration => false; @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionTypeBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionTypeBodyBuilderContext(this); } /// Return a map whose keys are the supertypes of this diff --git a/pkg/front_end/lib/src/source/source_factory_builder.dart b/pkg/front_end/lib/src/source/source_factory_builder.dart index 785647ba02dd..d7e263ad2a3c 100644 --- a/pkg/front_end/lib/src/source/source_factory_builder.dart +++ b/pkg/front_end/lib/src/source/source_factory_builder.dart @@ -345,14 +345,8 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl { void _checkRedirectingFactory(TypeEnvironment typeEnvironment) {} @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new FactoryBodyBuilderContext(this, _procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new FactoryBodyBuilderContext(this, _procedure); } @override @@ -535,14 +529,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { .createLocalTypeInferrer( fileUri, declarationBuilder.thisType, libraryBuilder, null); InferenceHelper helper = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - declarationBuilder.scope, - fileUri); + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationBuilder.scope, fileUri); Builder? targetBuilder = redirectionTarget.target; if (targetBuilder is SourceMemberBuilder) { // Ensure that target has been built. @@ -905,13 +893,7 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new RedirectingFactoryBodyBuilderContext(this, _procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new RedirectingFactoryBodyBuilderContext(this, _procedure); } } diff --git a/pkg/front_end/lib/src/source/source_field_builder.dart b/pkg/front_end/lib/src/source/source_field_builder.dart index ba50ae27c870..ba728afdfe3b 100644 --- a/pkg/front_end/lib/src/source/source_field_builder.dart +++ b/pkg/front_end/lib/src/source/source_field_builder.dart @@ -467,14 +467,8 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new FieldBodyBuilderContext(this, _fieldEncoding.builtMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new FieldBodyBuilderContext(this, _fieldEncoding.builtMember); } @override @@ -487,10 +481,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl MetadataBuilder.buildAnnotations( annotatable, metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, declarationBuilder?.scope ?? libraryBuilder.scope); @@ -508,13 +499,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl LookupScope scope = declarationBuilder?.scope ?? libraryBuilder.scope; BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - scope, - fileUri); + libraryBuilder, createBodyBuilderContext(), scope, fileUri); bodyBuilder.constantContext = isConst ? ConstantContext.inferred : ConstantContext.required; Expression initializer = bodyBuilder.typeInferrer diff --git a/pkg/front_end/lib/src/source/source_function_builder.dart b/pkg/front_end/lib/src/source/source_function_builder.dart index 624d7998b253..70d6b55ea7ec 100644 --- a/pkg/front_end/lib/src/source/source_function_builder.dart +++ b/pkg/front_end/lib/src/source/source_function_builder.dart @@ -476,26 +476,15 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl LookupScope parentScope = classOrExtensionBuilder?.scope ?? libraryBuilder.scope; for (Annotatable annotatable in annotatables) { - MetadataBuilder.buildAnnotations( - annotatable, - metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - libraryBuilder, - fileUri, - parentScope, + MetadataBuilder.buildAnnotations(annotatable, metadata, + createBodyBuilderContext(), libraryBuilder, fileUri, parentScope, createFileUriExpression: isAugmented); } if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { typeParameters![i].buildOutlineExpressions( libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), classHierarchy, computeTypeParameterScope(parentScope)); } diff --git a/pkg/front_end/lib/src/source/source_library_builder.dart b/pkg/front_end/lib/src/source/source_library_builder.dart index fd899442d4b1..8542f9de4c9d 100644 --- a/pkg/front_end/lib/src/source/source_library_builder.dart +++ b/pkg/front_end/lib/src/source/source_library_builder.dart @@ -1230,14 +1230,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new LibraryBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new LibraryBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -1252,15 +1246,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } MetadataBuilder.buildAnnotations( - library, - metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - this, - fileUri, - scope, + library, metadata, createBodyBuilderContext(), this, fileUri, scope, createFileUriExpression: isAugmenting); Iterator iterator = localMembersIterator; diff --git a/pkg/front_end/lib/src/source/source_loader.dart b/pkg/front_end/lib/src/source/source_loader.dart index cc951d256a96..d86b2c2ae7a6 100644 --- a/pkg/front_end/lib/src/source/source_loader.dart +++ b/pkg/front_end/lib/src/source/source_loader.dart @@ -1386,10 +1386,7 @@ severity: $severity BodyBuilder listener = dietListener.createListener( new ExpressionCompilerProcedureBodyBuildContext( dietListener, builder, builder.invokeTarget!, - isDeclarationInstanceMember: isClassInstanceMember, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), + isDeclarationInstanceMember: isClassInstanceMember), dietListener.memberScope, thisVariable: extensionThis); builder.procedure.function = parameters..parent = builder.procedure; diff --git a/pkg/front_end/lib/src/source/source_member_builder.dart b/pkg/front_end/lib/src/source/source_member_builder.dart index caa2e5b7276c..435163a83a05 100644 --- a/pkg/front_end/lib/src/source/source_member_builder.dart +++ b/pkg/front_end/lib/src/source/source_member_builder.dart @@ -64,10 +64,7 @@ abstract class SourceMemberBuilder implements MemberBuilder { AugmentSuperTarget? get augmentSuperTarget; - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); } mixin SourceMemberBuilderMixin implements SourceMemberBuilder { @@ -106,10 +103,7 @@ mixin SourceMemberBuilderMixin implements SourceMemberBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + BodyBuilderContext createBodyBuilderContext() { throw new UnimplementedError('$runtimeType.bodyBuilderContext'); } } diff --git a/pkg/front_end/lib/src/source/source_procedure_builder.dart b/pkg/front_end/lib/src/source/source_procedure_builder.dart index ea1e77ec9282..7af894cba453 100644 --- a/pkg/front_end/lib/src/source/source_procedure_builder.dart +++ b/pkg/front_end/lib/src/source/source_procedure_builder.dart @@ -698,14 +698,8 @@ class SourceProcedureBuilder extends SourceFunctionBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ProcedureBodyBuilderContext(this, procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ProcedureBodyBuilderContext(this, procedure); } // TODO(johnniwinther): Add annotations to tear-offs. diff --git a/pkg/front_end/lib/src/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/source/source_type_alias_builder.dart index 03f4f658a483..37a290ac12ac 100644 --- a/pkg/front_end/lib/src/source/source_type_alias_builder.dart +++ b/pkg/front_end/lib/src/source/source_type_alias_builder.dart @@ -363,14 +363,8 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { growable: true); } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new TypedefBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new TypedefBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -378,10 +372,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { MetadataBuilder.buildAnnotations( typedef, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, libraryBuilder.scope); @@ -389,10 +380,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { for (int i = 0; i < typeParameters!.length; i++) { typeParameters![i].buildOutlineExpressions( libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), classHierarchy, computeTypeParameterScope(libraryBuilder.scope)); } diff --git a/pkg/front_end/test/fasta/generator_to_string_test.dart b/pkg/front_end/test/fasta/generator_to_string_test.dart index e13ca1118f9c..a1107c2c159a 100644 --- a/pkg/front_end/test/fasta/generator_to_string_test.dart +++ b/pkg/front_end/test/fasta/generator_to_string_test.dart @@ -152,10 +152,7 @@ Future main() async { BodyBuilder helper = new BodyBuilder( libraryBuilder: libraryBuilder, - context: new LibraryBodyBuilderContext(libraryBuilder, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), + context: new LibraryBodyBuilderContext(libraryBuilder), uri: uri, enclosingScope: new FixedLocalScope(kind: ScopeKind.library, debugName: "dummy"),