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 && type == $double || |
500 (actual == $int && $_isFutureOr(type) | |
vsm
2017/03/23 19:37:44
Can type be FutureOr<FutureOr<T>> ?
Would somethi
Leaf
2017/03/23 20:27:31
Good idea, done.
| |
501 && $getGenericArgs(type)[0] == $double)) { | |
502 return true; | |
503 } | |
500 if (result === false) return false; | 504 if (result === false) return false; |
501 if (!$_ignoreWhitelistedErrors || ($ignoreFromWhiteList == void 0)) return res ult; | 505 if (!$_ignoreWhitelistedErrors || ($ignoreFromWhiteList == void 0)) return res ult; |
502 if ($_ignoreTypeFailure(actual, $type)) return true; | 506 if ($_ignoreTypeFailure(actual, $type)) return true; |
503 return result; | 507 return result; |
504 })()'''); | 508 })()'''); |
505 | 509 |
506 /// Returns true if [obj] is null or an instance of [type] | 510 /// 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] | 511 /// Returns false if [obj] is non-null and not an instance of [type] |
508 /// in strong mode | 512 /// in strong mode |
509 instanceOfOrNull(obj, type) => JS( | 513 instanceOfOrNull(obj, type) => JS( |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 name = '+' + name; | 979 name = '+' + name; |
976 } | 980 } |
977 return name; | 981 return name; |
978 } | 982 } |
979 | 983 |
980 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 984 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
981 /// | 985 /// |
982 /// Libraries are not actually deferred in DDC, so this just returns a future | 986 /// Libraries are not actually deferred in DDC, so this just returns a future |
983 /// that completes immediately. | 987 /// that completes immediately. |
984 Future loadLibrary() => new Future.value(); | 988 Future loadLibrary() => new Future.value(); |
OLD | NEW |