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

Unified Diff: pkg/dev_compiler/lib/js/common/dart_sdk.js

Issue 2671113002: fix #28642, handling of top and bottom types in DDC (Closed)
Patch Set: fix Created 3 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:
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/js/amd/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/es6/dart_sdk.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/js/common/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/common/dart_sdk.js b/pkg/dev_compiler/lib/js/common/dart_sdk.js
index e67f3b503706a17f55a42dd94d18c711793785f6..979392a9756ea55c05d0e603f73832b2db5a0fdf 100644
--- a/pkg/dev_compiler/lib/js/common/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/common/dart_sdk.js
@@ -1714,10 +1714,7 @@
return null;
}
}
- if (ret2 === dart.void) return true;
- if (ret1 === dart.void) {
- return ret2 === dart.dynamic || ret2 === async.FutureOr;
- }
+ if (ret1 === dart.void) return dart._isTop(ret2);
if (!dart._isSubtype(ret1, ret2, isCovariant)) return null;
return true;
};
@@ -1738,13 +1735,13 @@
};
};
dart._isBottom = function(type) {
- return type == dart.bottom;
+ return type == dart.bottom || type == core.Null;
};
dart._isTop = function(type) {
if (dart.getGenericClass(type) === dart.getGenericClass(async.FutureOr)) {
return dart._isTop(dart.getGenericArgs(type)[0]);
}
- return type == core.Object || type == dart.dynamic;
+ return type == core.Object || type == dart.dynamic || type == dart.void;
};
dart._isSubtype = function(t1, t2, isCovariant) {
if (t1 === t2) return true;
@@ -2223,6 +2220,9 @@
return false;
};
dart.is = function(obj, type) {
+ if (obj == null) {
+ return type == core.Null || dart._isTop(type);
+ }
let result = dart.strongInstanceOf(obj, type);
if (result !== null) return result;
let actual = dart.getReifiedType(obj);
« no previous file with comments | « pkg/dev_compiler/lib/js/amd/dart_sdk.js ('k') | pkg/dev_compiler/lib/js/es6/dart_sdk.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698