Chromium Code Reviews| Index: compiler/lib/implementation/core.js |
| diff --git a/compiler/lib/implementation/core.js b/compiler/lib/implementation/core.js |
| index 3ac10f35b3b2872d27cb5d9097127e97eba596dc..6240556c9a685fdae5344247bb04b21be48ba6da 100644 |
| --- a/compiler/lib/implementation/core.js |
| +++ b/compiler/lib/implementation/core.js |
| @@ -252,7 +252,6 @@ function assert(expr) { |
| } |
| } |
| -// TODO(jimhug): Remove these functions after updating compiler backend. |
| function BIT_OR$operator(val1, val2) { |
| return (typeof(val1) == 'number' && typeof(val2) == 'number') |
| ? val1 | val2 |
| @@ -334,6 +333,18 @@ function negate$operator(val) { |
| return (typeof(val) == 'number') ? -val : val.negate$operator(); |
| } |
| +function EQ$operator(val1, val2) { |
| + return (typeof val1 != 'object') |
|
floitsch
2012/01/19 11:31:59
what if val1 is a native string and val2 is a boxe
kasperl
2012/01/19 11:43:04
Good point. This code behaves the same (broken) wa
|
| + ? val1 === val2 |
| + : val1.EQ$operator(val2); |
| +} |
| + |
| +function NE$operator(val1, val2) { |
| + return (typeof val1 != 'object') |
|
floitsch
2012/01/19 11:31:59
ditto.
|
| + ? val1 !== val2 |
| + : !val1.EQ$operator(val2); |
| +} |
| + |
| function LT$operator(val1, val2) { |
| return (typeof(val1) == 'number' && typeof(val2) == 'number') |
| ? val1 < val2 |
| @@ -358,25 +369,6 @@ function GTE$operator(val1, val2) { |
| : val1.GTE$operator(val2); |
| } |
| - |
| -/** |
| - * These operators need to work correctly with undefined |
| - * so must be functions. |
| - */ |
| -function EQ$operator(val1, val2) { |
| - if (val1 === $Dart$Null) { |
| - return val2 === $Dart$Null; |
| - } else if (typeof(val1) == typeof(val2) && typeof val1 != 'object') { |
| - // number, boolean, string |
| - return val1 === val2; |
| - } |
| - return val1.EQ$operator(val2); |
| -} |
| - |
| -function NE$operator(val1, val2) { |
| - return !EQ$operator(val1, val2); |
| -} |
| - |
| // The following operator-functions are not called from Dart-generated code, but |
| // only from handwritten JS code. |
| function INDEX$operator(obj, index) { |