| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // TODO(jmesserly): restore this faster path once ES Symbol is treated as | 761 // TODO(jmesserly): restore this faster path once ES Symbol is treated as |
| 762 // an extension type (and thus hits the above code path). | 762 // an extension type (and thus hits the above code path). |
| 763 // See https://github.com/dart-lang/dev_compiler/issues/578. | 763 // See https://github.com/dart-lang/dev_compiler/issues/578. |
| 764 // return JS('', '"" + #', obj); | 764 // return JS('', '"" + #', obj); |
| 765 return JS('String', '#.toString()', obj); | 765 return JS('String', '#.toString()', obj); |
| 766 } | 766 } |
| 767 | 767 |
| 768 // TODO(jmesserly): is the argument type verified statically? | 768 // TODO(jmesserly): is the argument type verified statically? |
| 769 noSuchMethod(obj, Invocation invocation) { | 769 noSuchMethod(obj, Invocation invocation) { |
| 770 if (obj == null || JS('bool', 'typeof # == "function"', obj)) { | 770 if (obj == null || JS('bool', 'typeof # == "function"', obj)) { |
| 771 throw new NoSuchMethodError(obj, invocation.memberName, | 771 throwNoSuchMethodError(obj, invocation.memberName, |
| 772 invocation.positionalArguments, invocation.namedArguments); | 772 invocation.positionalArguments, invocation.namedArguments); |
| 773 } | 773 } |
| 774 // Delegate to the (possibly user-defined) method on the object. | 774 // Delegate to the (possibly user-defined) method on the object. |
| 775 var extension = getExtensionType(obj); | 775 var extension = getExtensionType(obj); |
| 776 if (extension != null) { | 776 if (extension != null) { |
| 777 return JS('', '#[dartx.noSuchMethod](#)', obj, invocation); | 777 return JS('', '#[dartx.noSuchMethod](#)', obj, invocation); |
| 778 } | 778 } |
| 779 return JS('', '#.noSuchMethod(#)', obj, invocation); | 779 return JS('', '#.noSuchMethod(#)', obj, invocation); |
| 780 } | 780 } |
| 781 | 781 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 name = '+' + name; | 840 name = '+' + name; |
| 841 } | 841 } |
| 842 return name; | 842 return name; |
| 843 } | 843 } |
| 844 | 844 |
| 845 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 845 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 846 /// | 846 /// |
| 847 /// Libraries are not actually deferred in DDC, so this just returns a future | 847 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 848 /// that completes immediately. | 848 /// that completes immediately. |
| 849 Future loadLibrary() => new Future.value(); | 849 Future loadLibrary() => new Future.value(); |
| OLD | NEW |