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

Unified Diff: lib/runtime/dart/_operations.js

Issue 1485353002: Expand generic type whitelist for function application checks (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Cleanup Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/_operations.js
diff --git a/lib/runtime/dart/_operations.js b/lib/runtime/dart/_operations.js
index fe7b6caa2e3af1224fea4f56972705f9f8bc44a6..082a0f4b2ed2f5e9c4782a61ca3bd194433a819b 100644
--- a/lib/runtime/dart/_operations.js
+++ b/lib/runtime/dart/_operations.js
@@ -185,14 +185,18 @@ dart_library.library('dart/_operations', null, /* Imports */[
return false;
}
- function strongInstanceOf(obj, type) {
+ function strongInstanceOf(obj, type, ignoreFromWhiteList) {
let actual = rtti.realRuntimeType(obj);
- return types.isSubtype(actual, type) || actual == types.jsobject;
+ if (types.isSubtype(actual, type) || actual == types.jsobject) return true;
+ if (ignoreFromWhiteList == void 0) return false;
+ if (types.isGroundType(type)) return false;
+ if (_ignoreTypeFailure(actual, type)) return true;
+ return false;
}
exports.strongInstanceOf = strongInstanceOf;
function instanceOfOrNull(obj, type) {
- if ((obj == null) || strongInstanceOf(obj, type)) return true;
+ if ((obj == null) || strongInstanceOf(obj, type, true)) return true;
return false;
}
@@ -225,6 +229,9 @@ dart_library.library('dart/_operations', null, /* Imports */[
exports.cast = cast;
function asInt(obj) {
+ if (obj == null) {
vsm 2015/12/01 23:52:14 This is an unrelated fix.
+ return null;
+ }
if (Math.floor(obj) != obj) {
// Note: null will also be caught by this check
errors.throwCastError(rtti.realRuntimeType(obj), core.int);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698