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

Unified Diff: test/class_hierarchy_basic.dart

Issue 2439043002: Introduce Substitution class and Supertype class. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « lib/visitor.dart ('k') | test/type_parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/class_hierarchy_basic.dart
diff --git a/test/class_hierarchy_basic.dart b/test/class_hierarchy_basic.dart
index 53eb212efc9c11b044ac9426696d711b87851d9d..4747b918b3bc973948f792ade1f24fe4b48a2ca2 100644
--- a/test/class_hierarchy_basic.dart
+++ b/test/class_hierarchy_basic.dart
@@ -14,8 +14,8 @@ class BasicClassHierarchy implements ClassHierarchy {
final Map<Class, Set<Class>> superclasses = <Class, Set<Class>>{};
final Map<Class, Set<Class>> superMixtures = <Class, Set<Class>>{};
final Map<Class, Set<Class>> supertypes = <Class, Set<Class>>{};
- final Map<Class, Map<Class, InterfaceType>> supertypeInstantiations =
- <Class, Map<Class, InterfaceType>>{};
+ final Map<Class, Map<Class, Supertype>> supertypeInstantiations =
+ <Class, Map<Class, Supertype>>{};
final Map<Class, Map<Name, Member>> gettersAndCalls =
<Class, Map<Name, Member>>{};
final Map<Class, Map<Name, Member>> setters = <Class, Map<Name, Member>>{};
@@ -112,14 +112,17 @@ class BasicClassHierarchy implements ClassHierarchy {
void buildSuperTypeInstantiations(Class node) {
if (supertypeInstantiations.containsKey(node)) return;
- supertypeInstantiations[node] = <Class, InterfaceType>{node: node.thisType};
+ supertypeInstantiations[node] = <Class, Supertype>{
+ node: node.asThisSupertype
+ };
for (var supertype in node.supers) {
var superclass = supertype.classNode;
buildSuperTypeInstantiations(superclass);
- var substitution = new Map<TypeParameter, DartType>.fromIterables(
+ var substitution = Substitution.fromPairs(
superclass.typeParameters, supertype.typeArguments);
supertypeInstantiations[superclass].forEach((key, type) {
- supertypeInstantiations[node][key] = substitute(type, substitution);
+ supertypeInstantiations[node][key] =
+ substitution.substituteSupertype(type);
});
}
}
@@ -163,7 +166,7 @@ class BasicClassHierarchy implements ClassHierarchy {
if (interfaceGettersAndCalls.containsKey(node)) return;
interfaceGettersAndCalls[node] = <Name, List<Member>>{};
interfaceSetters[node] = <Name, List<Member>>{};
- void inheritFrom(InterfaceType type) {
+ void inheritFrom(Supertype type) {
if (type == null) return;
buildInterfaceTable(type.classNode);
mergeMaps(interfaceGettersAndCalls[type.classNode],
@@ -203,7 +206,7 @@ class BasicClassHierarchy implements ClassHierarchy {
return supertypes[subtype].contains(supertype);
}
- InterfaceType getClassAsInstanceOf(Class type, Class supertype) {
+ Supertype getClassAsInstanceOf(Class type, Class supertype) {
return supertypeInstantiations[type][supertype];
}
« no previous file with comments | « lib/visitor.dart ('k') | test/type_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698