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

Unified Diff: lib/compiler/implementation/util/link_implementation.dart

Issue 10911006: Collect the types used in is-checks in the resolver phase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/util/link_implementation.dart
diff --git a/lib/compiler/implementation/util/link_implementation.dart b/lib/compiler/implementation/util/link_implementation.dart
index a237a307a12f92ac39e9f09a45101096b4434d21..1331f2e970be92f7a10e53a726c57d57aee31f65 100644
--- a/lib/compiler/implementation/util/link_implementation.dart
+++ b/lib/compiler/implementation/util/link_implementation.dart
@@ -70,6 +70,11 @@ class LinkTail<T> implements EmptyLink<T> {
bool isEmpty() => true;
void forEach(void f(T element)) {}
+
+ bool equals(other) {
+ if (other is !Link<T>) return false;
+ return other.isEmpty();
+ }
}
class LinkEntry<T> implements Link<T> {
@@ -134,6 +139,19 @@ class LinkEntry<T> implements Link<T> {
f(link.head);
}
}
+
+ bool equals(other) {
+ if (other is !Link<T>) return false;
+ Link<T> myElements = this;
+ while (!myElements.isEmpty() && !other.isEmpty()) {
ngeoffray 2012/08/30 13:17:46 How about doing it recursively? if (other.isEmpty(
karlklose 2012/09/05 09:36:01 I could. Do you want me to?
+ if (myElements.head != other.head) {
+ return false;
+ }
+ myElements = myElements.tail;
+ other = other.tail;
+ }
+ return myElements.isEmpty() && other.isEmpty();
+ }
}
class LinkBuilderImplementation<T> implements LinkBuilder<T> {
« lib/compiler/implementation/universe.dart ('K') | « lib/compiler/implementation/util/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698