| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 @JSExportName('is') | 474 @JSExportName('is') |
| 475 instanceOf(obj, type) => JS( | 475 instanceOf(obj, type) => JS( |
| 476 '', | 476 '', |
| 477 '''(() => { | 477 '''(() => { |
| 478 if ($obj == null) { | 478 if ($obj == null) { |
| 479 return $type == $Null || $_isTop($type); | 479 return $type == $Null || $_isTop($type); |
| 480 } | 480 } |
| 481 let result = $strongInstanceOf($obj, $type); | 481 let result = $strongInstanceOf($obj, $type); |
| 482 if (result !== null) return result; | 482 if (result !== null) return result; |
| 483 if (!$_failForWeakModeIsChecks) return false; |
| 483 let actual = $getReifiedType($obj); | 484 let actual = $getReifiedType($obj); |
| 484 $throwStrongModeError('Strong mode is-check failure: ' + | 485 $throwStrongModeError('Strong mode is-check failure: ' + |
| 485 $typeName(actual) + ' does not soundly subtype ' + | 486 $typeName(actual) + ' does not soundly subtype ' + |
| 486 $typeName($type)); | 487 $typeName($type)); |
| 487 })()'''); | 488 })()'''); |
| 488 | 489 |
| 489 @JSExportName('as') | 490 @JSExportName('as') |
| 490 cast(obj, type) { | 491 cast(obj, type) { |
| 491 if (JS('bool', '# == #', type, dynamic) || obj == null) return obj; | 492 if (JS('bool', '# == #', type, dynamic) || obj == null) return obj; |
| 492 bool result = strongInstanceOf(obj, type, true); | 493 bool result = strongInstanceOf(obj, type, true); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 name = '+' + name; | 933 name = '+' + name; |
| 933 } | 934 } |
| 934 return name; | 935 return name; |
| 935 } | 936 } |
| 936 | 937 |
| 937 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 938 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 938 /// | 939 /// |
| 939 /// Libraries are not actually deferred in DDC, so this just returns a future | 940 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 940 /// that completes immediately. | 941 /// that completes immediately. |
| 941 Future loadLibrary() => new Future.value(); | 942 Future loadLibrary() => new Future.value(); |
| OLD | NEW |