| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 return noSuchMethod( | 131 return noSuchMethod( |
| 132 obj, new InvocationImpl(field, JS('', '[#]', value), isSetter: true)); | 132 obj, new InvocationImpl(field, JS('', '[#]', value), isSetter: true)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 /// Check that a function of a given type can be applied to | 135 /// Check that a function of a given type can be applied to |
| 136 /// actuals. | 136 /// actuals. |
| 137 _checkApply(type, actuals) => JS( | 137 _checkApply(type, actuals) => JS( |
| 138 '', | 138 '', |
| 139 '''(() => { | 139 '''(() => { |
| 140 // TODO(vsm): Remove when we no longer need mirrors metadata. |
| 141 // An array is used to encode annotations attached to the type. |
| 142 if ($type instanceof Array) { |
| 143 $type = type[0]; |
| 144 } |
| 140 if ($actuals.length < $type.args.length) return false; | 145 if ($actuals.length < $type.args.length) return false; |
| 141 let index = 0; | 146 let index = 0; |
| 142 for(let i = 0; i < $type.args.length; ++i) { | 147 for(let i = 0; i < $type.args.length; ++i) { |
| 143 $check($actuals[i], $type.args[i]); | 148 $check($actuals[i], $type.args[i]); |
| 144 ++index; | 149 ++index; |
| 145 } | 150 } |
| 146 if ($actuals.length == $type.args.length) return true; | 151 if ($actuals.length == $type.args.length) return true; |
| 147 let extras = $actuals.length - $type.args.length; | 152 let extras = $actuals.length - $type.args.length; |
| 148 if ($type.optionals.length > 0) { | 153 if ($type.optionals.length > 0) { |
| 149 if (extras > $type.optionals.length) return false; | 154 if (extras > $type.optionals.length) return false; |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 name = '+' + name; | 967 name = '+' + name; |
| 963 } | 968 } |
| 964 return name; | 969 return name; |
| 965 } | 970 } |
| 966 | 971 |
| 967 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 972 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
| 968 /// | 973 /// |
| 969 /// Libraries are not actually deferred in DDC, so this just returns a future | 974 /// Libraries are not actually deferred in DDC, so this just returns a future |
| 970 /// that completes immediately. | 975 /// that completes immediately. |
| 971 Future loadLibrary() => new Future.value(); | 976 Future loadLibrary() => new Future.value(); |
| OLD | NEW |