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

Unified Diff: frog/leg/tree/nodes.dart

Issue 9427012: Allow binary operators on compile-time-constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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: frog/leg/tree/nodes.dart
diff --git a/frog/leg/tree/nodes.dart b/frog/leg/tree/nodes.dart
index c787f1696274675d04932001f05e35d62ee9b480..05804a557d2d101f7b2c643d2cc2c04d3bacbad1 100644
--- a/frog/leg/tree/nodes.dart
+++ b/frog/leg/tree/nodes.dart
@@ -703,6 +703,20 @@ class DartString implements Iterable<int> {
bool definitelyEquals(DartString other) => toString() == other.toString();
abstract Iterator<int> iterator();
abstract String toString();
+
+ bool operator ==(var other) {
+ if (other is !DartString) return false;
+ DartString otherString = other;
+ if (length != otherString.length) return false;
+ Iterator it1 = iterator();
+ Iterator it2 = otherString.iterator();
+ while (it1.hasNext()) {
+ assert(it2.hasNext());
ngeoffray 2012/02/21 11:22:09 I find this assert and the one line 717 too much.
floitsch 2012/02/22 10:17:51 Done.
+ if (it1.next() != it2.next()) return false;
+ }
+ assert(!it2.hasNext());
+ return true;
+ }
}
class LiteralDartString extends DartString {

Powered by Google App Engine
This is Rietveld 408576698