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

Side by Side Diff: pkg/compiler/lib/src/universe/class_set.dart

Issue 1352533002: Enqueue superclasses instead of supertypes. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Unify native behavior processing Created 5 years, 3 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
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | pkg/compiler/lib/src/universe/universe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 4
5 library dart2js.world.class_set; 5 library dart2js.world.class_set;
6 6
7 import 'dart:collection' show IterableBase; 7 import 'dart:collection' show IterableBase;
8 import '../elements/elements.dart' show ClassElement; 8 import '../elements/elements.dart' show ClassElement;
9 import '../util/util.dart' show Link; 9 import '../util/util.dart' show Link;
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool includeUninstantiated: true, 94 bool includeUninstantiated: true,
95 bool strict: false}) { 95 bool strict: false}) {
96 return new ClassHierarchyNodeIterable( 96 return new ClassHierarchyNodeIterable(
97 this, 97 this,
98 includeRoot: !strict, 98 includeRoot: !strict,
99 includeDirectlyInstantiated: includeDirectlyInstantiated, 99 includeDirectlyInstantiated: includeDirectlyInstantiated,
100 includeIndirectlyInstantiated: includeIndirectlyInstantiated, 100 includeIndirectlyInstantiated: includeIndirectlyInstantiated,
101 includeUninstantiated: includeUninstantiated); 101 includeUninstantiated: includeUninstantiated);
102 } 102 }
103 103
104 void dump(StringBuffer sb, String indentation) { 104 void printOn(StringBuffer sb, String indentation,
105 sb.write('$indentation$cls:['); 105 {bool instantiatedOnly: false}) {
106 sb.write('$indentation$cls');
107 if (isDirectlyInstantiated) {
108 sb.write(' directly');
109 }
110 if (isIndirectlyInstantiated) {
111 sb.write(' indirectly');
112 }
113 sb.write(' [');
106 if (_directSubclasses.isEmpty) { 114 if (_directSubclasses.isEmpty) {
107 sb.write(']'); 115 sb.write(']');
108 } else { 116 } else {
109 sb.write('\n');
110 bool needsComma = false; 117 bool needsComma = false;
111 for (Link<ClassHierarchyNode> link = _directSubclasses; 118 for (Link<ClassHierarchyNode> link = _directSubclasses;
112 !link.isEmpty; 119 !link.isEmpty;
113 link = link.tail) { 120 link = link.tail) {
121 if (instantiatedOnly && !link.head.isInstantiated) {
122 continue;
123 }
114 if (needsComma) { 124 if (needsComma) {
115 sb.write(',\n'); 125 sb.write(',\n');
126 } else {
127 sb.write('\n');
116 } 128 }
117 link.head.dump(sb, '$indentation '); 129 link.head.printOn(
130 sb, '$indentation ', instantiatedOnly: instantiatedOnly);
118 needsComma = true; 131 needsComma = true;
119 } 132 }
120 sb.write('\n'); 133 if (needsComma) {
121 sb.write('$indentation]'); 134 sb.write('\n');
135 sb.write('$indentation]');
136 } else {
137 sb.write(']');
138 }
122 } 139 }
123 } 140 }
124 141
142 String dump({String indentation: '', bool instantiatedOnly: false}) {
143 StringBuffer sb = new StringBuffer();
144 printOn(sb, indentation, instantiatedOnly: instantiatedOnly);
145 return sb.toString();
146 }
147
125 String toString() => cls.toString(); 148 String toString() => cls.toString();
126 } 149 }
127 150
128 /// Object holding the subclass and subtype relation for a single 151 /// Object holding the subclass and subtype relation for a single
129 /// [ClassElement]. 152 /// [ClassElement].
130 /// 153 ///
131 /// The subclass relation for a class `C` is modelled through a reference to 154 /// The subclass relation for a class `C` is modelled through a reference to
132 /// the [ClassHierarchyNode] for `C` in the global [ClassHierarchyNode] tree 155 /// the [ClassHierarchyNode] for `C` in the global [ClassHierarchyNode] tree
133 /// computed in [World]. 156 /// computed in [World].
134 /// 157 ///
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (!added) { 290 if (!added) {
268 newSubtypes.add(subtype); 291 newSubtypes.add(subtype);
269 } 292 }
270 _directSubtypes = newSubtypes; 293 _directSubtypes = newSubtypes;
271 } 294 }
272 } 295 }
273 296
274 String toString() { 297 String toString() {
275 StringBuffer sb = new StringBuffer(); 298 StringBuffer sb = new StringBuffer();
276 sb.write('[\n'); 299 sb.write('[\n');
277 node.dump(sb, ' '); 300 node.printOn(sb, ' ');
278 sb.write('\n'); 301 sb.write('\n');
279 if (_directSubtypes != null) { 302 if (_directSubtypes != null) {
280 for (ClassHierarchyNode node in _directSubtypes) { 303 for (ClassHierarchyNode node in _directSubtypes) {
281 node.dump(sb, ' '); 304 node.printOn(sb, ' ');
282 sb.write('\n'); 305 sb.write('\n');
283 } 306 }
284 } 307 }
285 sb.write(']'); 308 sb.write(']');
286 return sb.toString(); 309 return sb.toString();
287 } 310 }
288 } 311 }
289 312
290 /// Iterable for subclasses of a [ClassHierarchyNode]. 313 /// Iterable for subclasses of a [ClassHierarchyNode].
291 class ClassHierarchyNodeIterable extends IterableBase<ClassElement> { 314 class ClassHierarchyNodeIterable extends IterableBase<ClassElement> {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 includeDirectlyInstantiated: includeDirectlyInstantiated, 492 includeDirectlyInstantiated: includeDirectlyInstantiated,
470 includeIndirectlyInstantiated: includeIndirectlyInstantiated, 493 includeIndirectlyInstantiated: includeIndirectlyInstantiated,
471 includeUninstantiated: includeUninstantiated).iterator; 494 includeUninstantiated: includeUninstantiated).iterator;
472 if (elements.moveNext()) { 495 if (elements.moveNext()) {
473 return true; 496 return true;
474 } 497 }
475 } 498 }
476 return false; 499 return false;
477 } 500 }
478 } 501 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | pkg/compiler/lib/src/universe/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698