Skip to content

Commit a78235c

Browse files
johnniwintherCommit Queue
authored andcommitted
[cfe] Create constructors through fragments
Change-Id: If2a7095c09dcf2d73d326b6ba6d796acfa882c55 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408780 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent 3b750c5 commit a78235c

24 files changed

+1935
-1326
lines changed

pkg/front_end/lib/src/builder/formal_parameter_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class FormalParameterBuilder extends BuilderImpl
225225

226226
void finalizeInitializingFormal(
227227
DeclarationBuilder declarationBuilder,
228-
ConstructorDeclaration constructorDeclaration,
228+
ConstructorDeclarationBuilder constructorDeclaration,
229229
ClassHierarchyBase hierarchy) {
230230
String fieldName = isWildcardLoweredFormalParameter(name) ? '_' : name;
231231
Builder? fieldBuilder = declarationBuilder.lookupLocalMember(fieldName);

pkg/front_end/lib/src/fragment/constructor.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ConstructorFragment implements Fragment, FunctionFragment {
2222
final bool forAbstractClassOrMixin;
2323
Token? _beginInitializers;
2424

25-
AbstractSourceConstructorBuilder? _builder;
25+
SourceConstructorBuilderImpl? _builder;
2626

2727
ConstructorFragment(
2828
{required this.constructorName,
@@ -55,12 +55,12 @@ class ConstructorFragment implements Fragment, FunctionFragment {
5555
}
5656

5757
@override
58-
AbstractSourceConstructorBuilder get builder {
58+
SourceConstructorBuilderImpl get builder {
5959
assert(_builder != null, "Builder has not been computed for $this.");
6060
return _builder!;
6161
}
6262

63-
void set builder(AbstractSourceConstructorBuilder value) {
63+
void set builder(SourceConstructorBuilderImpl value) {
6464
assert(_builder == null, "Builder has already been computed for $this.");
6565
_builder = value;
6666
}
@@ -91,8 +91,7 @@ class _ConstructorBodyBuildingContext implements FunctionBodyBuildingContext {
9191
// constructor body. An error is reported by the parser but we skip
9292
// the body here to avoid overwriting the already lowering const
9393
// constructor.
94-
!(_fragment.builder is SourceExtensionTypeConstructorBuilder &&
95-
_fragment.modifiers.isConst);
94+
!(_fragment.builder.isExtensionTypeMember && _fragment.modifiers.isConst);
9695

9796
@override
9897
LocalScope computeFormalParameterScope(LookupScope typeParameterScope) {

0 commit comments

Comments
 (0)