Chromium Code Reviews| Index: compiler/lib/implementation/string.js |
| diff --git a/compiler/lib/implementation/string.js b/compiler/lib/implementation/string.js |
| index 75e249236354d1e07b54a41c21cf5b04562825c0..5d643d54e10b2c1c6582bad5ee5d207dfd26f46f 100644 |
| --- a/compiler/lib/implementation/string.js |
| +++ b/compiler/lib/implementation/string.js |
| @@ -18,8 +18,17 @@ function native_StringImplementation_get$length() { |
| } |
| function native_StringImplementation_EQ(other) { |
| - "use strict"; |
| - return typeof other == 'string' && this == other; |
| + // TODO(kasperl): We should really try to avoid having wrapped |
| + // strings floating around. The usually stem from referencing [this] |
|
mmendez
2012/01/19 17:09:47
Nit: the -> they.
|
| + // in Dart methods patched onto the String.prototype object. |
| + |
| + // Because of the checks in EQ$operator, we know [this] is a string |
| + // wrapper, but we have to make sure that [other] is either a |
| + // wrapper or a proper string before we can use == to compare the |
| + // contents. |
| + return (typeof(other) == 'string' || other.constructor === String) |
| + ? this == other |
| + : false; |
| } |
| function native_StringImplementation__nativeIndexOf(other, startIndex) { |