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

Side by Side Diff: pkg/kernel/lib/transformations/insert_covariance_checks.dart

Issue 2924713002: Replace ClassHierarchy.classes with getOrderedClasses(). (Closed)
Patch Set: Update getOrderedClasses() to return only given classes. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 library kernel.transformations.insert_covariance_checks; 4 library kernel.transformations.insert_covariance_checks;
5 5
6 import '../class_hierarchy.dart'; 6 import '../class_hierarchy.dart';
7 import '../clone.dart'; 7 import '../clone.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../kernel.dart'; 9 import '../kernel.dart';
10 import '../log.dart'; 10 import '../log.dart';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 /// entry point. This set is not therefore not the same as the set of keys 69 /// entry point. This set is not therefore not the same as the set of keys
70 /// in [unsafeMemberEntryPoint]. 70 /// in [unsafeMemberEntryPoint].
71 final Set<Member> membersWithCheckedEntryPoint = new Set<Member>(); 71 final Set<Member> membersWithCheckedEntryPoint = new Set<Member>();
72 72
73 InsertCovarianceChecks(this.coreTypes, this.hierarchy); 73 InsertCovarianceChecks(this.coreTypes, this.hierarchy);
74 74
75 void transformProgram(Program program) { 75 void transformProgram(Program program) {
76 types = new TypeEnvironment(coreTypes, hierarchy); 76 types = new TypeEnvironment(coreTypes, hierarchy);
77 // We transform every class before their subtypes. 77 // We transform every class before their subtypes.
78 // This ensures that transitive overrides are taken into account. 78 // This ensures that transitive overrides are taken into account.
79 hierarchy.classes.forEach(transformClass); 79 var unorderedClasses = program.libraries
80 .map((library) => library.classes)
81 .expand((classes) => classes);
82 var ordered = hierarchy.getOrderedClasses(unorderedClasses);
83 ordered.forEach(transformClass);
80 84
81 program.accept(new _CallTransformer(this)); 85 program.accept(new _CallTransformer(this));
82 } 86 }
83 87
84 void transformClass(Class class_) { 88 void transformClass(Class class_) {
85 new _ClassTransformer(class_, this).transformClass(); 89 new _ClassTransformer(class_, this).transformClass();
86 } 90 }
87 } 91 }
88 92
89 class _ClassTransformer { 93 class _ClassTransformer {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 @override 518 @override
515 visitPropertySet(PropertySet node) { 519 visitPropertySet(PropertySet node) {
516 var target = getChecked(node.receiver, node.interfaceTarget); 520 var target = getChecked(node.receiver, node.interfaceTarget);
517 if (target != null) { 521 if (target != null) {
518 node.interfaceTarget = target; 522 node.interfaceTarget = target;
519 node.name = target.name; 523 node.name = target.name;
520 } 524 }
521 node.visitChildren(this); 525 node.visitChildren(this);
522 } 526 }
523 } 527 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/src/incremental_class_hierarchy.dart ('k') | pkg/kernel/test/class_hierarchy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698