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

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

Issue 2918593003: Pass ClassHierarchy instead of creating it. (Closed)
Patch Set: 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 final Map<Member, Procedure> unsafeMemberEntryPoint = <Member, Procedure>{}; 63 final Map<Member, Procedure> unsafeMemberEntryPoint = <Member, Procedure>{};
64 64
65 /// Members that may be invoked through a checked entry point. 65 /// Members that may be invoked through a checked entry point.
66 /// 66 ///
67 /// Note that these members are not necessarily unsafe, because a safe member 67 /// Note that these members are not necessarily unsafe, because a safe member
68 /// can override an unsafe member, and thereby be invoked through a checked 68 /// can override an unsafe member, and thereby be invoked through a checked
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 hierarchy ??= new ClassHierarchy(program);
77 types = new TypeEnvironment(coreTypes, hierarchy); 76 types = new TypeEnvironment(coreTypes, hierarchy);
78 // We transform every class before their subtypes. 77 // We transform every class before their subtypes.
79 // This ensures that transitive overrides are taken into account. 78 // This ensures that transitive overrides are taken into account.
80 hierarchy.classes.forEach(transformClass); 79 hierarchy.classes.forEach(transformClass);
81 80
82 program.accept(new _CallTransformer(this)); 81 program.accept(new _CallTransformer(this));
83 } 82 }
84 83
85 void transformClass(Class class_) { 84 void transformClass(Class class_) {
86 new _ClassTransformer(class_, this).transformClass(); 85 new _ClassTransformer(class_, this).transformClass();
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 @override 514 @override
516 visitPropertySet(PropertySet node) { 515 visitPropertySet(PropertySet node) {
517 var target = getChecked(node.receiver, node.interfaceTarget); 516 var target = getChecked(node.receiver, node.interfaceTarget);
518 if (target != null) { 517 if (target != null) {
519 node.interfaceTarget = target; 518 node.interfaceTarget = target;
520 node.name = target.name; 519 node.name = target.name;
521 } 520 }
522 node.visitChildren(this); 521 node.visitChildren(this);
523 } 522 }
524 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698