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

Unified Diff: pkg/compiler/lib/src/ordered_typeset.dart

Issue 2476333003: don't rely on `identical` for comparing empty linked lists (Closed)
Patch Set: add back const Link, add TODO Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ordered_typeset.dart
diff --git a/pkg/compiler/lib/src/ordered_typeset.dart b/pkg/compiler/lib/src/ordered_typeset.dart
index e3cffb59409fc552b19cac2fae112a7895bd4351..4e37362ea4bd1035317432452b36bf8229b8971d 100644
--- a/pkg/compiler/lib/src/ordered_typeset.dart
+++ b/pkg/compiler/lib/src/ordered_typeset.dart
@@ -94,7 +94,9 @@ class OrderedTypeSet {
Link<DartType> pointer = _levels[level];
Link<DartType> end =
level > 0 ? _levels[level - 1] : const Link<DartType>();
- while (!identical(pointer, end)) {
+ // TODO(het): checking `isNotEmpty` should be unnecessary, remove when
+ // constants are properly canonicalized
+ while (pointer.isNotEmpty && !identical(pointer, end)) {
f(pointer.head);
pointer = pointer.tail;
}
@@ -107,7 +109,9 @@ class OrderedTypeSet {
Link<DartType> pointer = _levels[level];
Link<DartType> end =
level > 0 ? _levels[level - 1] : const Link<DartType>();
- while (!identical(pointer, end)) {
+ // TODO(het): checking `isNotEmpty` should be unnecessary, remove when
+ // constants are properly canonicalized
+ while (pointer.isNotEmpty && !identical(pointer, end)) {
if (cls == pointer.head.element) {
return pointer.head;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698