| 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 library dart2js.call_structure; | 5 library dart2js.call_structure; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show | 8 import '../common/names.dart' show |
| 9 Identifiers, | 9 Identifiers, |
| 10 Names, | 10 Names, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 * | 179 * |
| 180 * Returns [:true:] if the signature of the [caller] matches the | 180 * Returns [:true:] if the signature of the [caller] matches the |
| 181 * signature of the [callee], [:false:] otherwise. | 181 * signature of the [callee], [:false:] otherwise. |
| 182 */ | 182 */ |
| 183 static /*<T>*/ bool addForwardingElementArgumentsToList( | 183 static /*<T>*/ bool addForwardingElementArgumentsToList( |
| 184 ConstructorElement caller, | 184 ConstructorElement caller, |
| 185 List/*<T>*/ list, | 185 List/*<T>*/ list, |
| 186 ConstructorElement callee, | 186 ConstructorElement callee, |
| 187 /*T*/ compileArgument(ParameterElement element), | 187 /*T*/ compileArgument(ParameterElement element), |
| 188 /*T*/ compileConstant(ParameterElement element)) { | 188 /*T*/ compileConstant(ParameterElement element)) { |
| 189 assert(invariant(caller, !callee.isErroneous, | 189 assert(invariant(caller, !callee.isMalformed, |
| 190 message: "Cannot compute arguments to erroneous constructor: " | 190 message: "Cannot compute arguments to malformed constructor: " |
| 191 "$caller calling $callee.")); | 191 "$caller calling $callee.")); |
| 192 | 192 |
| 193 FunctionSignature signature = caller.functionSignature; | 193 FunctionSignature signature = caller.functionSignature; |
| 194 Map<Node, ParameterElement> mapping = <Node, ParameterElement>{}; | 194 Map<Node, ParameterElement> mapping = <Node, ParameterElement>{}; |
| 195 | 195 |
| 196 // TODO(ngeoffray): This is a hack that fakes up AST nodes, so | 196 // TODO(ngeoffray): This is a hack that fakes up AST nodes, so |
| 197 // that we can call [addArgumentsToList]. | 197 // that we can call [addArgumentsToList]. |
| 198 Link<Node> computeCallNodesFromParameters() { | 198 Link<Node> computeCallNodesFromParameters() { |
| 199 LinkBuilder<Node> builder = new LinkBuilder<Node>(); | 199 LinkBuilder<Node> builder = new LinkBuilder<Node>(); |
| 200 signature.forEachRequiredParameter((ParameterElement element) { | 200 signature.forEachRequiredParameter((ParameterElement element) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return first.compareTo(second); | 283 return first.compareTo(second); |
| 284 }); | 284 }); |
| 285 return _orderedNamedArguments; | 285 return _orderedNamedArguments; |
| 286 } | 286 } |
| 287 | 287 |
| 288 @override | 288 @override |
| 289 String structureToString() { | 289 String structureToString() { |
| 290 return 'arity=$argumentCount, named=[${namedArguments.join(', ')}]'; | 290 return 'arity=$argumentCount, named=[${namedArguments.join(', ')}]'; |
| 291 } | 291 } |
| 292 } | 292 } |
| OLD | NEW |