[cfe] Move parent, name, charOffset and fileUri to subclasses

Change-Id: Ic9928a1a235182e7c660f7bc0b729fa0355b8f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389120
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/lib/src/builder/builtin_type_declaration_builder.dart b/pkg/front_end/lib/src/builder/builtin_type_declaration_builder.dart
index 79011ca..9b156d8 100644
--- a/pkg/front_end/lib/src/builder/builtin_type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/builtin_type_declaration_builder.dart
@@ -6,15 +6,23 @@
 
 abstract class BuiltinTypeDeclarationBuilder extends TypeDeclarationBuilderImpl
     implements TypeDeclarationBuilder {
+  @override
+  final LibraryBuilder parent;
+
+  @override
+  final int charOffset;
+
+  @override
+  final String name;
+
   final DartType type;
 
   @override
   final Uri fileUri;
 
   BuiltinTypeDeclarationBuilder(
-      String name, this.type, LibraryBuilder compilationUnit, int charOffset)
-      : fileUri = compilationUnit.fileUri,
-        super(name, compilationUnit, charOffset);
+      this.name, this.type, this.parent, this.charOffset)
+      : fileUri = parent.fileUri;
 
   @override
   DartType buildAliasedType(
diff --git a/pkg/front_end/lib/src/builder/class_builder.dart b/pkg/front_end/lib/src/builder/class_builder.dart
index a7f63ad..bfbcf37 100644
--- a/pkg/front_end/lib/src/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/builder/class_builder.dart
@@ -179,10 +179,6 @@
   InterfaceType? _nonNullableRawType;
   InterfaceType? _thisType;
 
-  ClassBuilderImpl(
-      String name, LibraryBuilder parent, Uri fileUri, int fileOffset)
-      : super(name, parent, fileUri, fileOffset);
-
   @override
   bool get isMixinApplication => mixedInTypeBuilder != null;
 
@@ -299,9 +295,8 @@
   @override
   bool get isFutureOr {
     if (name == "FutureOr") {
-      LibraryBuilder parentLibrary = parent as LibraryBuilder;
-      if (parentLibrary.importUri.isScheme("dart") &&
-          parentLibrary.importUri.path == "async") {
+      if (parent.importUri.isScheme("dart") &&
+          parent.importUri.path == "async") {
         return true;
       }
     }
diff --git a/pkg/front_end/lib/src/builder/declaration_builder.dart b/pkg/front_end/lib/src/builder/declaration_builder.dart
index aff63a4..5f7b365 100644
--- a/pkg/front_end/lib/src/builder/declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/declaration_builder.dart
@@ -51,16 +51,11 @@
 abstract class DeclarationBuilderImpl extends TypeDeclarationBuilderImpl
     implements IDeclarationBuilder {
   @override
-  final Uri fileUri;
-
-  DeclarationBuilderImpl(
-      String name, LibraryBuilder parent, this.fileUri, int fileOffset)
-      : super(name, parent, fileOffset);
+  LibraryBuilder get parent;
 
   @override
   LibraryBuilder get libraryBuilder {
-    LibraryBuilder library = parent as LibraryBuilder;
-    return library.partOfLibrary ?? library;
+    return parent.partOfLibrary ?? parent;
   }
 
   @override
diff --git a/pkg/front_end/lib/src/builder/extension_builder.dart b/pkg/front_end/lib/src/builder/extension_builder.dart
index d11d83c..5e1fdbb 100644
--- a/pkg/front_end/lib/src/builder/extension_builder.dart
+++ b/pkg/front_end/lib/src/builder/extension_builder.dart
@@ -33,10 +33,6 @@
 abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
     with DeclarationBuilderMixin
     implements ExtensionBuilder {
-  ExtensionBuilderImpl(
-      String name, LibraryBuilder parent, Uri fileUri, int fileOffset)
-      : super(name, parent, fileUri, fileOffset);
-
   @override
   DartType buildAliasedTypeWithBuiltArguments(
       LibraryBuilder library,
diff --git a/pkg/front_end/lib/src/builder/extension_type_declaration_builder.dart b/pkg/front_end/lib/src/builder/extension_type_declaration_builder.dart
index b8033bc..2c28a2a 100644
--- a/pkg/front_end/lib/src/builder/extension_type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/extension_type_declaration_builder.dart
@@ -38,10 +38,6 @@
     extends DeclarationBuilderImpl
     with DeclarationBuilderMixin
     implements ExtensionTypeDeclarationBuilder {
-  ExtensionTypeDeclarationBuilderImpl(
-      String name, LibraryBuilder parent, Uri fileUri, int fileOffset)
-      : super(name, parent, fileUri, fileOffset);
-
   @override
   DartType buildAliasedTypeWithBuiltArguments(
       LibraryBuilder library,
diff --git a/pkg/front_end/lib/src/builder/invalid_type_declaration_builder.dart b/pkg/front_end/lib/src/builder/invalid_type_declaration_builder.dart
index 956be1d..a072c89 100644
--- a/pkg/front_end/lib/src/builder/invalid_type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/invalid_type_declaration_builder.dart
@@ -7,15 +7,24 @@
 class InvalidTypeDeclarationBuilder extends TypeDeclarationBuilderImpl
     with ErroneousMemberBuilderMixin
     implements TypeDeclarationBuilder {
+  @override
+  final String name;
+
   final LocatedMessage message;
 
   final List<LocatedMessage>? context;
 
   final bool suppressMessage;
 
-  InvalidTypeDeclarationBuilder(String name, this.message,
-      {this.context, this.suppressMessage = true})
-      : super(name, null, message.charOffset);
+  InvalidTypeDeclarationBuilder(this.name, this.message,
+      {this.context, this.suppressMessage = true});
+
+  @override
+  Builder? get parent => null;
+
+  @override
+  // Coverage-ignore(suite): Not run.
+  int get charOffset => message.charOffset;
 
   @override
   // Coverage-ignore(suite): Not run.
diff --git a/pkg/front_end/lib/src/builder/omitted_type_declaration_builder.dart b/pkg/front_end/lib/src/builder/omitted_type_declaration_builder.dart
index 44e8dd7..deecb4c 100644
--- a/pkg/front_end/lib/src/builder/omitted_type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/omitted_type_declaration_builder.dart
@@ -11,11 +11,19 @@
 /// inferred types in the original code.
 class OmittedTypeDeclarationBuilder extends TypeDeclarationBuilderImpl
     implements TypeDeclarationBuilder {
+  @override
+  final SourceLibraryBuilder parent;
+
+  @override
+  final String name;
+
   final OmittedTypeBuilder omittedTypeBuilder;
 
   OmittedTypeDeclarationBuilder(
-      String name, this.omittedTypeBuilder, SourceLibraryBuilder parent)
-      : super(name, parent, TreeNode.noOffset);
+      this.name, this.omittedTypeBuilder, this.parent);
+
+  @override
+  int get charOffset => TreeNode.noOffset;
 
   @override
   DartType buildAliasedType(
@@ -55,5 +63,5 @@
   }
 
   @override
-  Uri? get fileUri => parent!.fileUri;
+  Uri? get fileUri => parent.fileUri;
 }
diff --git a/pkg/front_end/lib/src/builder/type_alias_builder.dart b/pkg/front_end/lib/src/builder/type_alias_builder.dart
index b1fee9c..2dd6705 100644
--- a/pkg/front_end/lib/src/builder/type_alias_builder.dart
+++ b/pkg/front_end/lib/src/builder/type_alias_builder.dart
@@ -129,25 +129,15 @@
 
 abstract class TypeAliasBuilderImpl extends TypeDeclarationBuilderImpl
     implements TypeAliasBuilder {
-  @override
-  final Uri fileUri;
-
   TypeBuilder? _unaliasedRhsType;
 
   List<TypeAliasBuilder> _typeAliasesUsedInUnaliasing = [];
 
-  TypeAliasBuilderImpl(
-      String name, LibraryBuilder parent, this.fileUri, int fileOffset)
-      : super(name, parent, fileOffset);
-
   @override
   String get debugName => "TypeAliasBuilder";
 
   @override
-  LibraryBuilder get parent => super.parent as LibraryBuilder;
-
-  @override
-  LibraryBuilder get libraryBuilder => super.parent as LibraryBuilder;
+  LibraryBuilder get libraryBuilder => parent;
 
   /// [arguments] have already been built.
   @override
diff --git a/pkg/front_end/lib/src/builder/type_declaration_builder.dart b/pkg/front_end/lib/src/builder/type_declaration_builder.dart
index 0531932..922dfa36 100644
--- a/pkg/front_end/lib/src/builder/type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/builder/type_declaration_builder.dart
@@ -61,17 +61,6 @@
 abstract class TypeDeclarationBuilderImpl extends BuilderImpl
     implements ITypeDeclarationBuilder {
   @override
-  final Builder? parent;
-
-  @override
-  final int charOffset;
-
-  @override
-  final String name;
-
-  TypeDeclarationBuilderImpl(this.name, this.parent, this.charOffset);
-
-  @override
   TypeDeclarationBuilder get origin => this as TypeDeclarationBuilder;
 
   @override
diff --git a/pkg/front_end/lib/src/builder/type_variable_builder.dart b/pkg/front_end/lib/src/builder/type_variable_builder.dart
index 19ff2d4..0621fe4 100644
--- a/pkg/front_end/lib/src/builder/type_variable_builder.dart
+++ b/pkg/front_end/lib/src/builder/type_variable_builder.dart
@@ -24,6 +24,12 @@
 
 sealed class TypeVariableBuilder extends TypeDeclarationBuilderImpl
     implements TypeDeclarationBuilder {
+  @override
+  final int charOffset;
+
+  @override
+  final String name;
+
   TypeBuilder? bound;
 
   TypeBuilder? defaultType;
@@ -39,14 +45,17 @@
 
   final List<MetadataBuilder>? metadata;
 
-  TypeVariableBuilder(String name, int charOffset, this.fileUri,
+  TypeVariableBuilder(this.name, this.charOffset, this.fileUri,
       {this.bound,
       this.defaultType,
       required this.kind,
       Variance? variableVariance,
       this.metadata,
-      this.isWildcard = false})
-      : super(name, null, charOffset);
+      this.isWildcard = false});
+
+  @override
+  // Coverage-ignore(suite): Not run.
+  Builder? get parent => null;
 
   @override
   bool get isTypeVariable => true;
diff --git a/pkg/front_end/lib/src/dill/dill_class_builder.dart b/pkg/front_end/lib/src/dill/dill_class_builder.dart
index b5563b7..828a7b7 100644
--- a/pkg/front_end/lib/src/dill/dill_class_builder.dart
+++ b/pkg/front_end/lib/src/dill/dill_class_builder.dart
@@ -49,6 +49,9 @@
 class DillClassBuilder extends ClassBuilderImpl
     with DillClassMemberAccessMixin {
   @override
+  final DillLibraryBuilder parent;
+
+  @override
   final Class cls;
 
   late final LookupScope _scope;
@@ -63,9 +66,8 @@
 
   List<TypeBuilder>? _interfaceBuilders;
 
-  DillClassBuilder(this.cls, DillLibraryBuilder parent)
-      : _nameSpace = new DeclarationNameSpaceImpl(),
-        super(cls.name, parent, cls.fileUri, cls.fileOffset) {
+  DillClassBuilder(this.cls, this.parent)
+      : _nameSpace = new DeclarationNameSpaceImpl() {
     _scope = new NameSpaceLookupScope(
         _nameSpace, ScopeKind.declaration, "class ${cls.name}",
         parent: parent.scope);
@@ -74,6 +76,15 @@
   }
 
   @override
+  int get charOffset => cls.fileOffset;
+
+  @override
+  String get name => cls.name;
+
+  @override
+  Uri get fileUri => cls.fileUri;
+
+  @override
   // Coverage-ignore(suite): Not run.
   LookupScope get scope => _scope;
 
@@ -131,9 +142,6 @@
   }
 
   @override
-  Uri get fileUri => cls.fileUri;
-
-  @override
   TypeBuilder? get supertypeBuilder {
     TypeBuilder? supertype = _supertypeBuilder;
     if (supertype == null) {
diff --git a/pkg/front_end/lib/src/dill/dill_extension_builder.dart b/pkg/front_end/lib/src/dill/dill_extension_builder.dart
index 05debaf..f0f6372 100644
--- a/pkg/front_end/lib/src/dill/dill_extension_builder.dart
+++ b/pkg/front_end/lib/src/dill/dill_extension_builder.dart
@@ -7,15 +7,18 @@
 import '../base/name_space.dart';
 import '../base/scope.dart';
 import '../builder/declaration_builders.dart';
-import '../builder/library_builder.dart';
 import '../builder/type_builder.dart';
 import 'dill_builder_mixins.dart';
 import 'dill_class_builder.dart';
 import 'dill_extension_member_builder.dart';
+import 'dill_library_builder.dart';
 
 class DillExtensionBuilder extends ExtensionBuilderImpl
     with DillDeclarationBuilderMixin {
   @override
+  final DillLibraryBuilder parent;
+
+  @override
   final Extension extension;
 
   late final LookupScope _scope;
@@ -27,9 +30,8 @@
   List<NominalVariableBuilder>? _typeParameters;
   TypeBuilder? _onType;
 
-  DillExtensionBuilder(this.extension, LibraryBuilder parent)
-      : _nameSpace = new DeclarationNameSpaceImpl(),
-        super(extension.name, parent, extension.fileUri, extension.fileOffset) {
+  DillExtensionBuilder(this.extension, this.parent)
+      : _nameSpace = new DeclarationNameSpaceImpl() {
     _scope = new NameSpaceLookupScope(
         _nameSpace, ScopeKind.declaration, "extension ${extension.name}",
         parent: parent.scope);
@@ -86,6 +88,15 @@
   }
 
   @override
+  int get charOffset => extension.fileOffset;
+
+  @override
+  String get name => extension.name;
+
+  @override
+  Uri get fileUri => extension.fileUri;
+
+  @override
   // Coverage-ignore(suite): Not run.
   LookupScope get scope => _scope;
 
diff --git a/pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart b/pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart
index 7e1500a..8ec3113 100644
--- a/pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart
+++ b/pkg/front_end/lib/src/dill/dill_extension_type_declaration_builder.dart
@@ -17,6 +17,9 @@
 class DillExtensionTypeDeclarationBuilder
     extends ExtensionTypeDeclarationBuilderImpl
     with DillClassMemberAccessMixin, DillDeclarationBuilderMixin {
+  @override
+  final DillLibraryBuilder parent;
+
   final ExtensionTypeDeclaration _extensionTypeDeclaration;
 
   late final LookupScope _scope;
@@ -32,13 +35,8 @@
   TypeBuilder? _declaredRepresentationTypeBuilder;
 
   DillExtensionTypeDeclarationBuilder(
-      this._extensionTypeDeclaration, DillLibraryBuilder parent)
-      : _nameSpace = new DeclarationNameSpaceImpl(),
-        super(
-            _extensionTypeDeclaration.name,
-            parent,
-            _extensionTypeDeclaration.fileUri,
-            _extensionTypeDeclaration.fileOffset) {
+      this._extensionTypeDeclaration, this.parent)
+      : _nameSpace = new DeclarationNameSpaceImpl() {
     _scope = new NameSpaceLookupScope(_nameSpace, ScopeKind.declaration,
         "extension type ${_extensionTypeDeclaration.name}",
         parent: parent.scope);
@@ -141,7 +139,18 @@
   }
 
   @override
-  DillLibraryBuilder get libraryBuilder => parent as DillLibraryBuilder;
+  // Coverage-ignore(suite): Not run.
+  int get charOffset => _extensionTypeDeclaration.fileOffset;
+
+  @override
+  String get name => _extensionTypeDeclaration.name;
+
+  @override
+  // Coverage-ignore(suite): Not run.
+  Uri get fileUri => _extensionTypeDeclaration.fileUri;
+
+  @override
+  DillLibraryBuilder get libraryBuilder => parent;
 
   @override
   // Coverage-ignore(suite): Not run.
diff --git a/pkg/front_end/lib/src/dill/dill_type_alias_builder.dart b/pkg/front_end/lib/src/dill/dill_type_alias_builder.dart
index fe0589e..132c33a 100644
--- a/pkg/front_end/lib/src/dill/dill_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/dill/dill_type_alias_builder.dart
@@ -15,6 +15,9 @@
 
 class DillTypeAliasBuilder extends TypeAliasBuilderImpl {
   @override
+  final DillLibraryBuilder parent;
+
+  @override
   final Typedef typedef;
 
   @override
@@ -26,8 +29,16 @@
   @override
   DartType? thisType;
 
-  DillTypeAliasBuilder(this.typedef, this.tearOffs, DillLibraryBuilder parent)
-      : super(typedef.name, parent, typedef.fileUri, typedef.fileOffset);
+  DillTypeAliasBuilder(this.typedef, this.tearOffs, this.parent);
+
+  @override
+  int get charOffset => typedef.fileOffset;
+
+  @override
+  String get name => typedef.name;
+
+  @override
+  Uri get fileUri => typedef.fileUri;
 
   @override
   Reference get reference => typedef.reference;
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 f4f2438..c0c8ded 100644
--- a/pkg/front_end/lib/src/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/source/source_class_builder.dart
@@ -92,6 +92,18 @@
         Comparable<SourceClassBuilder>,
         ClassDeclaration,
         SourceDeclarationBuilder {
+  @override
+  final SourceLibraryBuilder parent;
+
+  @override
+  final int charOffset;
+
+  @override
+  final String name;
+
+  @override
+  final Uri fileUri;
+
   final Modifiers _modifiers;
 
   final List<MetadataBuilder>? metadata;
@@ -153,26 +165,26 @@
   SourceClassBuilder(
       this.metadata,
       this._modifiers,
-      String name,
+      this.name,
       this.typeVariables,
       this.supertypeBuilder,
       this.interfaceBuilders,
       this.onTypes,
       this.typeParameterScope,
       this.nameSpaceBuilder,
-      SourceLibraryBuilder parent,
+      this.parent,
       this.constructorReferences,
-      Uri fileUri,
+      this.fileUri,
       int startCharOffset,
       int nameOffset,
       int charEndOffset,
       this.indexedClass,
       {this.mixedInTypeBuilder,
       this.isMixinDeclaration = false})
-      : actualCls = initializeClass(typeVariables, name, fileUri,
+      : charOffset = nameOffset,
+        actualCls = initializeClass(typeVariables, name, fileUri,
             startCharOffset, nameOffset, charEndOffset, indexedClass,
-            isAugmentation: _modifiers.isAugment),
-        super(name, parent, fileUri, nameOffset) {
+            isAugmentation: _modifiers.isAugment) {
     actualCls.hasConstConstructor = declaresConstConstructor;
   }
 
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 285be57..e6396ca 100644
--- a/pkg/front_end/lib/src/source/source_extension_builder.dart
+++ b/pkg/front_end/lib/src/source/source_extension_builder.dart
@@ -29,6 +29,15 @@
 class SourceExtensionBuilder extends ExtensionBuilderImpl
     with SourceDeclarationBuilderMixin {
   @override
+  final SourceLibraryBuilder parent;
+
+  @override
+  final int charOffset;
+
+  @override
+  final Uri fileUri;
+
+  @override
   final List<MetadataBuilder>? metadata;
 
   final Modifiers _modifiers;
@@ -68,12 +77,14 @@
       required this.typeParameterScope,
       required DeclarationNameSpaceBuilder nameSpaceBuilder,
       required SourceLibraryBuilder enclosingLibraryBuilder,
-      required Uri fileUri,
+      required this.fileUri,
       required int startOffset,
       required int nameOffset,
       required int endOffset,
       required Reference? reference})
-      : _modifiers = modifiers,
+      : charOffset = nameOffset,
+        parent = enclosingLibraryBuilder,
+        _modifiers = modifiers,
         _extension = new Extension(
             name: extensionName.name,
             fileUri: fileUri,
@@ -82,13 +93,14 @@
             reference: reference)
           ..isUnnamedExtension = extensionName.isUnnamedExtension
           ..fileOffset = nameOffset,
-        _nameSpaceBuilder = nameSpaceBuilder,
-        super(
-            extensionName.name, enclosingLibraryBuilder, fileUri, nameOffset) {
+        _nameSpaceBuilder = nameSpaceBuilder {
     extensionName.attachExtension(_extension);
   }
 
   @override
+  String get name => extensionName.name;
+
+  @override
   LookupScope get scope => _scope;
 
   @override
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 c00c5ae..092b1af 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
@@ -50,6 +50,18 @@
         Comparable<SourceExtensionTypeDeclarationBuilder>,
         ClassDeclaration {
   @override
+  final SourceLibraryBuilder parent;
+
+  @override
+  final int charOffset;
+
+  @override
+  final String name;
+
+  @override
+  final Uri fileUri;
+
+  @override
   final List<MetadataBuilder>? metadata;
 
   final Modifiers _modifiers;
@@ -91,20 +103,22 @@
   SourceExtensionTypeDeclarationBuilder(
       {required this.metadata,
       required Modifiers modifiers,
-      required String name,
+      required this.name,
       required this.typeParameters,
       required this.interfaceBuilders,
       required this.typeParameterScope,
       required DeclarationNameSpaceBuilder nameSpaceBuilder,
       required SourceLibraryBuilder enclosingLibraryBuilder,
       required this.constructorReferences,
-      required Uri fileUri,
+      required this.fileUri,
       required int startOffset,
       required int nameOffset,
       required int endOffset,
       required this.indexedContainer,
       required FieldFragment? representationFieldFragment})
-      : _modifiers = modifiers,
+      : parent = enclosingLibraryBuilder,
+        charOffset = nameOffset,
+        _modifiers = modifiers,
         _extensionTypeDeclaration = new ExtensionTypeDeclaration(
             name: name,
             fileUri: fileUri,
@@ -113,8 +127,7 @@
             reference: indexedContainer?.reference)
           ..fileOffset = nameOffset,
         _nameSpaceBuilder = nameSpaceBuilder,
-        _representationFieldFragment = representationFieldFragment,
-        super(name, enclosingLibraryBuilder, fileUri, nameOffset);
+        _representationFieldFragment = representationFieldFragment;
 
   @override
   LookupScope get scope => _scope;
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 ae74ef0..e88fdb8 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
@@ -28,6 +28,18 @@
 import 'source_loader.dart';
 
 class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
+  @override
+  final SourceLibraryBuilder parent;
+
+  @override
+  final int charOffset;
+
+  @override
+  final String name;
+
+  @override
+  final Uri fileUri;
+
   late TypeBuilder _type;
 
   final Reference _reference;
@@ -43,16 +55,17 @@
   TypedefFragment _introductory;
 
   SourceTypeAliasBuilder(
-      {required String name,
+      {required this.name,
       required SourceLibraryBuilder enclosingLibraryBuilder,
-      required Uri fileUri,
+      required this.fileUri,
       required int fileOffset,
       required TypedefFragment fragment,
       required Reference? reference})
-      : _reference = reference ?? new Reference(),
+      : charOffset = fileOffset,
+        parent = enclosingLibraryBuilder,
+        _reference = reference ?? new Reference(),
         _introductory = fragment,
-        _type = fragment.type,
-        super(name, enclosingLibraryBuilder, fileUri, fileOffset) {
+        _type = fragment.type {
     _introductory.builder = this;
   }
 
diff --git a/pkg/front_end/test/coverage_suite_expected.dart b/pkg/front_end/test/coverage_suite_expected.dart
index d29b737..460f655 100644
--- a/pkg/front_end/test/coverage_suite_expected.dart
+++ b/pkg/front_end/test/coverage_suite_expected.dart
@@ -250,12 +250,12 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/builtin_type_declaration_builder.dart": (
-    hitCount: 7,
+    hitCount: 6,
     missCount: 0,
   ),
   // 100.0%.
   "package:front_end/src/builder/class_builder.dart": (
-    hitCount: 142,
+    hitCount: 141,
     missCount: 0,
   ),
   // 100.0%.
@@ -265,7 +265,7 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/declaration_builder.dart": (
-    hitCount: 24,
+    hitCount: 23,
     missCount: 0,
   ),
   // 100.0%.
@@ -275,12 +275,12 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/extension_builder.dart": (
-    hitCount: 3,
+    hitCount: 1,
     missCount: 0,
   ),
   // 100.0%.
   "package:front_end/src/builder/extension_type_declaration_builder.dart": (
-    hitCount: 11,
+    hitCount: 9,
     missCount: 0,
   ),
   // 100.0%.
@@ -315,7 +315,7 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/invalid_type_declaration_builder.dart": (
-    hitCount: 18,
+    hitCount: 17,
     missCount: 0,
   ),
   // 100.0%.
@@ -385,7 +385,7 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/type_alias_builder.dart": (
-    hitCount: 182,
+    hitCount: 178,
     missCount: 0,
   ),
   // 100.0%.
@@ -395,12 +395,12 @@
   ),
   // 100.0%.
   "package:front_end/src/builder/type_declaration_builder.dart": (
-    hitCount: 7,
+    hitCount: 6,
     missCount: 0,
   ),
   // 100.0%.
   "package:front_end/src/builder/type_variable_builder.dart": (
-    hitCount: 314,
+    hitCount: 313,
     missCount: 0,
   ),
   // 100.0%.
@@ -425,12 +425,12 @@
   ),
   // 100.0%.
   "package:front_end/src/dill/dill_class_builder.dart": (
-    hitCount: 178,
+    hitCount: 181,
     missCount: 0,
   ),
   // 100.0%.
   "package:front_end/src/dill/dill_extension_builder.dart": (
-    hitCount: 82,
+    hitCount: 88,
     missCount: 0,
   ),
   // 100.0%.
@@ -470,7 +470,7 @@
   ),
   // 100.0%.
   "package:front_end/src/dill/dill_type_alias_builder.dart": (
-    hitCount: 50,
+    hitCount: 55,
     missCount: 0,
   ),
   // 100.0%.
@@ -810,7 +810,7 @@
   ),
   // 100.0%.
   "package:front_end/src/source/source_class_builder.dart": (
-    hitCount: 1262,
+    hitCount: 1261,
     missCount: 0,
   ),
   // 100.0%.
@@ -830,13 +830,13 @@
   ),
   // 100.0%.
   "package:front_end/src/source/source_extension_builder.dart": (
-    hitCount: 94,
+    hitCount: 95,
     missCount: 0,
   ),
   // 100.0%.
   "package:front_end/src/source/source_extension_type_declaration_builder.dart":
       (
-    hitCount: 485,
+    hitCount: 484,
     missCount: 0,
   ),
   // 100.0%.
@@ -876,7 +876,7 @@
   ),
   // 100.0%.
   "package:front_end/src/source/source_type_alias_builder.dart": (
-    hitCount: 349,
+    hitCount: 348,
     missCount: 0,
   ),
   // 100.0%.
diff --git a/pkg/front_end/test/extensions/data/export_unnamed/lib.dart b/pkg/front_end/test/extensions/data/export_unnamed/lib.dart
index cc8c797..218e0ed 100644
--- a/pkg/front_end/test/extensions/data/export_unnamed/lib.dart
+++ b/pkg/front_end/test/extensions/data/export_unnamed/lib.dart
@@ -7,7 +7,7 @@
   _extension#1]*/
 
 /*class: _extension#1:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#1,
  builder-onType=String,
  extension-members=[static staticMethod=_extension#1|staticMethod],
  extension-name=_extension#1,
diff --git a/pkg/front_end/test/extensions/data/part/part.dart b/pkg/front_end/test/extensions/data/part/part.dart
index e687fca..2db30cd 100644
--- a/pkg/front_end/test/extensions/data/part/part.dart
+++ b/pkg/front_end/test/extensions/data/part/part.dart
@@ -30,7 +30,7 @@
 }
 
 /*class: _extension#1:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#1,
  builder-onType=String,
  extension-members=[
   stringMethod=_extension#1|stringMethod,
diff --git a/pkg/front_end/test/extensions/data/unnamed_declarations.dart b/pkg/front_end/test/extensions/data/unnamed_declarations.dart
index 3a27ea2..1e7c85f 100644
--- a/pkg/front_end/test/extensions/data/unnamed_declarations.dart
+++ b/pkg/front_end/test/extensions/data/unnamed_declarations.dart
@@ -12,7 +12,7 @@
 class A1 {}
 
 /*class: _extension#0:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#0,
  builder-onType=A1,
  extension-members=[
   method=_extension#0|method,
@@ -38,7 +38,7 @@
 }
 
 /*class: _extension#1:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#1,
  builder-onType=A1,
  extension-members=[
   method=_extension#1|method,
@@ -66,7 +66,7 @@
 class B1<T> {}
 
 /*class: _extension#2:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#2,
  builder-onType=B1<T>,
  builder-type-params=[T],
  extension-members=[
@@ -98,7 +98,7 @@
 }
 
 /*class: _extension#3:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#3,
  builder-onType=B1<A1>,
  extension-members=[
   method=_extension#3|method,
@@ -124,7 +124,7 @@
 }
 
 /*class: _extension#4:
- builder-name=_unnamed-extension_,
+ builder-name=_extension#4,
  builder-onType=B1<T>,
  builder-type-params=[T extends A1],
  extension-members=[