| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 var f = obj != null ? JS('', '#[#]', obj, symbol) : null; | 305 var f = obj != null ? JS('', '#[#]', obj, symbol) : null; |
| 306 var ftype = getMethodType(obj, symbol); | 306 var ftype = getMethodType(obj, symbol); |
| 307 return _checkAndCall(f, ftype, obj, typeArgs, args, displayName); | 307 return _checkAndCall(f, ftype, obj, typeArgs, args, displayName); |
| 308 } | 308 } |
| 309 | 309 |
| 310 dsend(obj, method, @rest args) => _callMethod(obj, method, null, args, method); | 310 dsend(obj, method, @rest args) => _callMethod(obj, method, null, args, method); |
| 311 | 311 |
| 312 dgsend(obj, typeArgs, method, @rest args) => | 312 dgsend(obj, typeArgs, method, @rest args) => |
| 313 _callMethod(obj, method, typeArgs, args, method); | 313 _callMethod(obj, method, typeArgs, args, method); |
| 314 | 314 |
| 315 dindex(obj, index) => _callMethod(obj, '_get', null, JS('', '[#]', index), '[]')
; | 315 dindex(obj, index) => |
| 316 _callMethod(obj, '_get', null, JS('', '[#]', index), '[]'); |
| 316 | 317 |
| 317 dsetindex(obj, index, value) => | 318 dsetindex(obj, index, value) => |
| 318 _callMethod(obj, '_set', null, JS('', '[#, #]', index, value), '[]='); | 319 _callMethod(obj, '_set', null, JS('', '[#, #]', index, value), '[]='); |
| 319 | 320 |
| 320 /// TODO(leafp): This duplicates code in types.dart. | 321 /// TODO(leafp): This duplicates code in types.dart. |
| 321 /// I haven't found a way to factor it out that makes the | 322 /// I haven't found a way to factor it out that makes the |
| 322 /// code generator happy though. | 323 /// code generator happy though. |
| 323 _ignoreMemo(f) => JS( | 324 _ignoreMemo(f) => JS( |
| 324 '', | 325 '', |
| 325 '''(() => { | 326 '''(() => { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 540 } |
| 540 } else if (typeof $values === 'object') { | 541 } else if (typeof $values === 'object') { |
| 541 for (let key of $getOwnPropertyNames($values)) { | 542 for (let key of $getOwnPropertyNames($values)) { |
| 542 map._set(key, $values[key]); | 543 map._set(key, $values[key]); |
| 543 } | 544 } |
| 544 } | 545 } |
| 545 return map; | 546 return map; |
| 546 })()'''); | 547 })()'''); |
| 547 | 548 |
| 548 @JSExportName('assert') | 549 @JSExportName('assert') |
| 549 assert_(condition) => JS( | 550 assert_(condition, [message]) => JS( |
| 550 '', | 551 '', |
| 551 '''(() => { | 552 '''(() => { |
| 552 if (!$condition) $throwAssertionError(); | 553 if (!$condition) $throwAssertionError(message); |
| 553 })()'''); | 554 })()'''); |
| 554 | 555 |
| 555 var _stack = null; | 556 var _stack = null; |
| 556 @JSExportName('throw') | 557 @JSExportName('throw') |
| 557 throw_(obj) => JS( | 558 throw_(obj) => JS( |
| 558 '', | 559 '', |
| 559 '''(() => { | 560 '''(() => { |
| 560 $_stack = new Error(); | 561 $_stack = new Error(); |
| 561 throw $obj; | 562 throw $obj; |
| 562 })()'''); | 563 })()'''); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 name = '+' + name; | 841 name = '+' + name; |
| 841 } | 842 } |
| 842 return name; | 843 return name; |
| 843 } | 844 } |
| 844 | 845 |
| 845 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 846 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 846 /// | 847 /// |
| 847 /// Libraries are not actually deferred in DDC, so this just returns a future | 848 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 848 /// that completes immediately. | 849 /// that completes immediately. |
| 849 Future loadLibrary() => new Future.value(); | 850 Future loadLibrary() => new Future.value(); |
| OLD | NEW |