Chromium Code Reviews| 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 { |