Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: pkg/compiler/lib/src/resolution/class_hierarchy.dart

Issue 1811173003: Support per-library serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/resolution/class_hierarchy.dart
diff --git a/pkg/compiler/lib/src/resolution/class_hierarchy.dart b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
index f46b9fdc345e2f4bfdaa6eca017466a926b932bc..78e2341c0ef1a1dd09931b6158b89dbda6a19927 100644
--- a/pkg/compiler/lib/src/resolution/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
@@ -55,7 +55,10 @@ class TypeDefinitionVisitor extends MappingVisitor<DartType> {
scope = Scope.buildEnclosingScope(element),
super(compiler, registry);
- DartType get objectType => compiler.coreTypes.objectType;
+ CoreTypes get coreTypes => compiler.coreTypes;
+
+ DartType get objectType => coreTypes.objectType;
+
void resolveTypeVariableBounds(NodeList node) {
if (node == null) return;
@@ -245,7 +248,7 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
}
InterfaceType enumType = element.computeType(resolution);
- element.supertype = compiler.coreTypes.objectType;
+ element.supertype = objectType;
element.interfaces = const Link<DartType>();
calculateAllSupertypes(element);
@@ -579,24 +582,10 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
if (cls.allSupertypesAndSelf != null) return;
final DartType supertype = cls.supertype;
if (supertype != null) {
- OrderedTypeSetBuilder allSupertypes = new OrderedTypeSetBuilder(cls);
- // TODO(15296): Collapse these iterations to one when the order is not
- // needed.
- allSupertypes.add(compiler, supertype);
- for (Link<DartType> interfaces = cls.interfaces;
- !interfaces.isEmpty;
- interfaces = interfaces.tail) {
- allSupertypes.add(compiler, interfaces.head);
- }
-
- addAllSupertypes(allSupertypes, supertype);
- for (Link<DartType> interfaces = cls.interfaces;
- !interfaces.isEmpty;
- interfaces = interfaces.tail) {
- addAllSupertypes(allSupertypes, interfaces.head);
- }
- allSupertypes.add(compiler, cls.computeType(resolution));
- cls.allSupertypesAndSelf = allSupertypes.toTypeSet();
+ cls.allSupertypesAndSelf =
+ new OrderedTypeSetBuilder(
+ cls, reporter: reporter, objectType: coreTypes.objectType)
+ .createOrderedTypeSet(supertype, cls.interfaces);
} else {
assert(cls == compiler.coreClasses.objectClass);
cls.allSupertypesAndSelf =
@@ -604,27 +593,8 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
}
}
- /**
- * Adds [type] and all supertypes of [type] to [allSupertypes] while
- * substituting type variables.
- */
- void addAllSupertypes(OrderedTypeSetBuilder allSupertypes,
- InterfaceType type) {
- ClassElement classElement = type.element;
- Link<DartType> supertypes = classElement.allSupertypes;
- assert(invariant(element, supertypes != null,
- message: "Supertypes not computed on $classElement "
- "during resolution of $element"));
- while (!supertypes.isEmpty) {
- DartType supertype = supertypes.head;
- allSupertypes.add(compiler, supertype.substByContext(type));
- supertypes = supertypes.tail;
- }
- }
-
isBlackListed(DartType type) {
LibraryElement lib = element.library;
- CoreTypes coreTypes = compiler.coreTypes;
return
!identical(lib, compiler.coreLibrary) &&
!compiler.backend.isBackendLibrary(lib) &&
« no previous file with comments | « pkg/compiler/lib/src/ordered_typeset.dart ('k') | pkg/compiler/lib/src/serialization/element_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698