Chromium Code Reviews| 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); |