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

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

Issue 1856953003: Test closed world model after deserialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 8 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) 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 7 import 'dart:collection' show
8 IterableBase; 8 IterableBase;
9 import '../elements/elements.dart' show 9 import '../elements/elements.dart' show
10 ClassElement; 10 ClassElement;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 } 175 }
176 176
177 /// Adds [subclass] as a direct subclass of [cls]. 177 /// Adds [subclass] as a direct subclass of [cls].
178 void addDirectSubclass(ClassHierarchyNode subclass) { 178 void addDirectSubclass(ClassHierarchyNode subclass) {
179 assert(subclass.cls.superclass == cls); 179 assert(subclass.cls.superclass == cls);
180 assert(!_directSubclasses.contains(subclass)); 180 assert(!_directSubclasses.contains(subclass));
181 _directSubclasses = _directSubclasses.prepend(subclass); 181 _directSubclasses = _directSubclasses.prepend(subclass);
182 } 182 }
183 183
184 Iterable<ClassHierarchyNode> get directSubclasses => _directSubclasses;
185
184 /// Returns `true` if [other] is contained in the subtree of this node. 186 /// Returns `true` if [other] is contained in the subtree of this node.
185 /// 187 ///
186 /// This means that [other] is a subclass of [cls]. 188 /// This means that [other] is a subclass of [cls].
187 bool contains(ClassElement other) { 189 bool contains(ClassElement other) {
188 while (other != null) { 190 while (other != null) {
189 if (cls == other) return true; 191 if (cls == other) return true;
190 if (cls.hierarchyDepth >= other.hierarchyDepth) return false; 192 if (cls.hierarchyDepth >= other.hierarchyDepth) return false;
191 other = other.superclass; 193 other = other.superclass;
192 } 194 }
193 return false; 195 return false;
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 /// Iteration stops immediately. 879 /// Iteration stops immediately.
878 STOP, 880 STOP,
879 /// Iteration skips the subclasses of the current class. 881 /// Iteration skips the subclasses of the current class.
880 SKIP_SUBCLASSES, 882 SKIP_SUBCLASSES,
881 } 883 }
882 884
883 /// Visiting function used for the `forEachX` functions of [ClassHierarchyNode] 885 /// Visiting function used for the `forEachX` functions of [ClassHierarchyNode]
884 /// and [ClassSet]. The return value controls the continued iteration. If `null` 886 /// and [ClassSet]. The return value controls the continued iteration. If `null`
885 /// is returned, iteration continues to the end. 887 /// is returned, iteration continues to the end.
886 typedef IterationStep ForEachFunction(ClassElement cls); 888 typedef IterationStep ForEachFunction(ClassElement cls);
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | tests/compiler/dart2js/serialization_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698