Skip to content

Commit 938d9c0

Browse files
johnniwintherCommit Queue
authored andcommitted
[cfe] Create synthesized super classes late
This moves the creation of class builders for anonymous mixin application to after the creation of the normal class builders. A ClassDeclaration interface is added to support class builders from different fragments. This is also a step towards creating class builders fully through fragments. TEST=existing Change-Id: Ia6b4a17648bdc89b89fd3cfdfe39d24d347b6341 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407420 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
1 parent 98e29db commit 938d9c0

File tree

744 files changed

+12920
-12715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

744 files changed

+12920
-12715
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
cfe=pkg/front_end/test/id_tests/metadata_evaluate_test.dart
2-

pkg/front_end/lib/src/base/scope.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,6 @@ extension IteratorExtension<T extends Builder> on Iterator<T> {
10781078
}
10791079
}
10801080

1081-
// Coverage-ignore(suite): Not run.
10821081
List<T> toList() {
10831082
List<T> list = [];
10841083
while (moveNext()) {

pkg/front_end/lib/src/compute_platform_binaries_location.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ Uri computePlatformBinariesLocation({bool forceBuildDir = false}) {
9696
// The directory of the Dart VM executable.
9797
Uri vmDirectory = Uri.base
9898
.resolveUri(
99-
new Uri.file(resolvedExecutable ?? Platform.resolvedExecutable))
99+
new Uri.file(resolvedExecutable ?? // Coverage-ignore(suite): Not run.
100+
Platform.resolvedExecutable))
100101
.resolve(".");
101102
if (vmDirectory.path.endsWith("/bin/")) {
102103
// Looks like the VM is in a `/bin/` directory, so this is running from a

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class NamedMixinApplicationFragment implements Fragment {
4343
return _builder!;
4444
}
4545

46-
// Coverage-ignore(suite): Not run.
4746
void set builder(SourceClassBuilder value) {
4847
assert(_builder == null, "Builder has already been computed for $this.");
4948
_builder = value;

pkg/front_end/lib/src/kernel/benchmarker.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ enum BenchmarkPhases {
173173
outline_checkSemantics,
174174
outline_finishTypeParameters,
175175
outline_createTypeInferenceEngine,
176+
outline_computeSupertypes,
176177
outline_buildComponent,
177178
outline_installDefaultSupertypes,
178179
outline_installSyntheticConstructors,

pkg/front_end/lib/src/kernel/kernel_target.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ class KernelTarget {
391391
Iterable<SourceLibraryBuilder> libraryBuilders) {
392392
loader.computeLibraryScopes(libraryBuilders);
393393
loader.resolveTypes(libraryBuilders);
394+
loader.computeSupertypes(libraryBuilders);
394395
loader.computeDefaultTypes(
395396
libraryBuilders, dynamicType, nullType, bottomType, objectClassBuilder);
396397
}
@@ -421,6 +422,11 @@ class KernelTarget {
421422
?.enterPhase(BenchmarkPhases.outline_resolveTypes);
422423
loader.resolveTypes(loader.sourceLibraryBuilders);
423424

425+
benchmarker
426+
// Coverage-ignore(suite): Not run.
427+
?.enterPhase(BenchmarkPhases.outline_computeSupertypes);
428+
loader.computeSupertypes(loader.sourceLibraryBuilders);
429+
424430
benchmarker
425431
// Coverage-ignore(suite): Not run.
426432
?.enterPhase(BenchmarkPhases.outline_computeMacroApplications);
@@ -1381,7 +1387,7 @@ class KernelTarget {
13811387
_finishConstructors(extensionTypeDeclaration);
13821388
}
13831389

1384-
void _finishConstructors(ClassDeclaration classDeclaration) {
1390+
void _finishConstructors(ClassDeclarationBuilder classDeclaration) {
13851391
SourceLibraryBuilder libraryBuilder = classDeclaration.libraryBuilder;
13861392

13871393
/// Quotes below are from [Dart Programming Language Specification, 4th

pkg/front_end/lib/src/source/class_declaration.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import 'source_library_builder.dart';
1515
/// as a regular class declaration and an extension type declaration.
1616
// TODO(johnniwinther): Should this be renamed now that inline classes are
1717
// renamed to extension type declarations?
18-
abstract class ClassDeclaration
18+
// TODO(johnniwinther): Merge this with [IDeclarationBuilder]? Extensions are
19+
// the only declarations without constructors, this might come with the static
20+
// extension feature.
21+
abstract class ClassDeclarationBuilder
1922
implements IDeclarationBuilder, ClassMemberAccess {
2023
@override
2124
SourceLibraryBuilder get libraryBuilder;
@@ -79,7 +82,7 @@ abstract class ClassDeclaration
7982
Iterator<T> localConstructorIterator<T extends MemberBuilder>();
8083
}
8184

82-
mixin ClassDeclarationMixin implements ClassDeclaration {
85+
mixin ClassDeclarationBuilderMixin implements ClassDeclarationBuilder {
8386
List<ConstructorReferenceBuilder>? get constructorReferences;
8487

8588
@override
@@ -107,13 +110,14 @@ mixin ClassDeclarationMixin implements ClassDeclaration {
107110
}
108111
}
109112

110-
abstract class ClassDeclarationAugmentationAccess<D extends ClassDeclaration> {
113+
abstract class ClassDeclarationAugmentationAccess<
114+
D extends ClassDeclarationBuilder> {
111115
D getOrigin(D classDeclaration);
112116

113117
Iterable<D>? getAugmentations(D classDeclaration);
114118
}
115119

116-
class ClassDeclarationMemberIterator<D extends ClassDeclaration,
120+
class ClassDeclarationMemberIterator<D extends ClassDeclarationBuilder,
117121
T extends Builder> implements Iterator<T> {
118122
Iterator<T>? _iterator;
119123
Iterator<D>? augmentationBuilders;
@@ -171,7 +175,7 @@ class ClassDeclarationMemberIterator<D extends ClassDeclaration,
171175
}
172176

173177
// Coverage-ignore(suite): Not run.
174-
class ClassDeclarationMemberNameIterator<D extends ClassDeclaration,
178+
class ClassDeclarationMemberNameIterator<D extends ClassDeclarationBuilder,
175179
T extends Builder> implements NameIterator<T> {
176180
NameIterator<T>? _iterator;
177181
Iterator<D>? augmentationBuilders;
@@ -224,7 +228,7 @@ class ClassDeclarationMemberNameIterator<D extends ClassDeclaration,
224228
String get name => _iterator?.name ?? (throw new StateError('No element'));
225229
}
226230

227-
class ClassDeclarationConstructorIterator<D extends ClassDeclaration,
231+
class ClassDeclarationConstructorIterator<D extends ClassDeclarationBuilder,
228232
T extends MemberBuilder> implements Iterator<T> {
229233
Iterator<T>? _iterator;
230234
Iterator<D>? augmentationBuilders;
@@ -283,7 +287,7 @@ class ClassDeclarationConstructorIterator<D extends ClassDeclaration,
283287
(throw new StateError('No element'));
284288
}
285289

286-
class ClassDeclarationConstructorNameIterator<D extends ClassDeclaration,
290+
class ClassDeclarationConstructorNameIterator<D extends ClassDeclarationBuilder,
287291
T extends MemberBuilder> implements NameIterator<T> {
288292
NameIterator<T>? _iterator;
289293
Iterator<D>? augmentationBuilders;

0 commit comments

Comments
 (0)