| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// This library defines runtime operations on objects used by the code | 5 /// This library defines runtime operations on objects used by the code |
| 6 /// generator. | 6 /// generator. |
| 7 part of dart._runtime; | 7 part of dart._runtime; |
| 8 | 8 |
| 9 class InvocationImpl extends Invocation { | 9 class InvocationImpl extends Invocation { |
| 10 final Symbol memberName; | 10 final Symbol memberName; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 /// Returns false if [obj] is not an instance of [type] in both spec | 489 /// Returns false if [obj] is not an instance of [type] in both spec |
| 490 /// and strong mode | 490 /// and strong mode |
| 491 /// Returns null if [obj] is not an instance of [type] in strong mode | 491 /// Returns null if [obj] is not an instance of [type] in strong mode |
| 492 /// but might be in spec mode | 492 /// but might be in spec mode |
| 493 bool strongInstanceOf(obj, type, ignoreFromWhiteList) => JS( | 493 bool strongInstanceOf(obj, type, ignoreFromWhiteList) => JS( |
| 494 '', | 494 '', |
| 495 '''(() => { | 495 '''(() => { |
| 496 let actual = $getReifiedType($obj); | 496 let actual = $getReifiedType($obj); |
| 497 let result = $isSubtype(actual, $type); | 497 let result = $isSubtype(actual, $type); |
| 498 if (result || actual == $jsobject || | 498 if (result || actual == $jsobject || |
| 499 actual == $int && type == $double) return true; | 499 (actual == $int && $isSubtype($double, $type))) return true; |
| 500 if (result === false) return false; | 500 if (result === false) return false; |
| 501 if (!$_ignoreWhitelistedErrors || ($ignoreFromWhiteList == void 0)) return res
ult; | 501 if (!$_ignoreWhitelistedErrors || ($ignoreFromWhiteList == void 0)) return res
ult; |
| 502 if ($_ignoreTypeFailure(actual, $type)) return true; | 502 if ($_ignoreTypeFailure(actual, $type)) return true; |
| 503 return result; | 503 return result; |
| 504 })()'''); | 504 })()'''); |
| 505 | 505 |
| 506 /// Returns true if [obj] is null or an instance of [type] | 506 /// Returns true if [obj] is null or an instance of [type] |
| 507 /// Returns false if [obj] is non-null and not an instance of [type] | 507 /// Returns false if [obj] is non-null and not an instance of [type] |
| 508 /// in strong mode | 508 /// in strong mode |
| 509 instanceOfOrNull(obj, type) => JS( | 509 instanceOfOrNull(obj, type) => JS( |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 name = '+' + name; | 975 name = '+' + name; |
| 976 } | 976 } |
| 977 return name; | 977 return name; |
| 978 } | 978 } |
| 979 | 979 |
| 980 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 980 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 981 /// | 981 /// |
| 982 /// Libraries are not actually deferred in DDC, so this just returns a future | 982 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 983 /// that completes immediately. | 983 /// that completes immediately. |
| 984 Future loadLibrary() => new Future.value(); | 984 Future loadLibrary() => new Future.value(); |
| OLD | NEW |