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

Unified Diff: lib/compiler/implementation/lib/js_helper.dart

Issue 10533151: Make undefined and null equivalent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 6 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/lib/js_helper.dart
diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart
index db57efebbcf6943c6f0df86e855fda895f742f47..a7b2f06a280802240ec6c0f0e40707368b3c3077 100644
--- a/lib/compiler/implementation/lib/js_helper.dart
+++ b/lib/compiler/implementation/lib/js_helper.dart
@@ -171,6 +171,7 @@ tdiv(var a, var b) {
}
eq(var a, var b) {
+ if (JS('bool', @"# == null", a)) return JS('bool', @"# == null", b);
if (JS('bool', @'typeof # === "object"', a)) {
if (JS_HAS_EQUALS(a)) {
return UNINTERCEPTED(a == b);
@@ -183,6 +184,7 @@ eq(var a, var b) {
}
bool eqB(var a, var b) {
+ if (JS('bool', @"# == null", a)) return JS('bool', @"# == null", b);
if (JS('bool', @'typeof # === "object"', a)) {
if (JS_HAS_EQUALS(a)) {
return UNINTERCEPTED(a == b) === true;
@@ -199,27 +201,23 @@ eqq(var a, var b) {
}
eqNull(var a) {
+ if (JS('bool', @'# == null', a)) return true;
if (JS('bool', @'typeof # === "object"', a)) {
if (JS_HAS_EQUALS(a)) {
return UNINTERCEPTED(a == null);
- } else {
- return false;
}
- } else {
- return JS('bool', @'typeof # === "undefined"', a);
}
+ return false;
}
-bool eqNullB(var a) {
+eqNullB(var a) {
+ if (JS('bool', @'# == null', a)) return true;
if (JS('bool', @'typeof # === "object"', a)) {
if (JS_HAS_EQUALS(a)) {
return UNINTERCEPTED(a == null) === true;
- } else {
- return false;
}
- } else {
- return JS('bool', @'typeof # === "undefined"', a);
}
+ return false;
}
gt$slow(var a, var b) {

Powered by Google App Engine
This is Rietveld 408576698