| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.transformations.mixin_full_resolution; | 4 library kernel.transformations.mixin_full_resolution; |
| 5 | 5 |
| 6 import '../ast.dart'; | 6 import '../ast.dart'; |
| 7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
| 8 import '../clone.dart'; | 8 import '../clone.dart'; |
| 9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
| 10 import '../type_algebra.dart'; | 10 import '../type_algebra.dart'; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ConstructorInvocation _createInvocation(String methodName, | 274 ConstructorInvocation _createInvocation(String methodName, |
| 275 Arguments callArguments, bool isSuperInvocation, Expression receiver) { | 275 Arguments callArguments, bool isSuperInvocation, Expression receiver) { |
| 276 if (_invocationMirrorConstructor == null) { | 276 if (_invocationMirrorConstructor == null) { |
| 277 Class clazz = coreTypes.getClass('dart:core', '_InvocationMirror'); | 277 Class clazz = coreTypes.getClass('dart:core', '_InvocationMirror'); |
| 278 _invocationMirrorConstructor = clazz.constructors[0]; | 278 _invocationMirrorConstructor = clazz.constructors[0]; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // The _InvocationMirror constructor takes the following arguments: | 281 // The _InvocationMirror constructor takes the following arguments: |
| 282 // * Method name (a string). | 282 // * Method name (a string). |
| 283 // * An arguments descriptor - a list consisting of: | 283 // * An arguments descriptor - a list consisting of: |
| 284 // - length of passed type argument vector, 0 if none passed. |
| 284 // - number of arguments (including receiver). | 285 // - number of arguments (including receiver). |
| 285 // - number of positional arguments (including receiver). | 286 // - number of positional arguments (including receiver). |
| 286 // - pairs (2 entries in the list) of | 287 // - pairs (2 entries in the list) of |
| 287 // * named arguments name. | 288 // * named arguments name. |
| 288 // * index of named argument in arguments list. | 289 // * index of named argument in arguments list. |
| 289 // * A list of arguments, where the first ones are the positional arguments. | 290 // * A list of arguments, where the first ones are the positional arguments. |
| 290 // * Whether it's a super invocation or not. | 291 // * Whether it's a super invocation or not. |
| 291 | 292 |
| 293 int typeArgsLen = 0; // TODO(regis): Type arguments of generic function. |
| 292 int numPositionalArguments = callArguments.positional.length + 1; | 294 int numPositionalArguments = callArguments.positional.length + 1; |
| 293 int numArguments = numPositionalArguments + callArguments.named.length; | 295 int numArguments = numPositionalArguments + callArguments.named.length; |
| 294 List<Expression> argumentsDescriptor = [ | 296 List<Expression> argumentsDescriptor = [ |
| 297 new IntLiteral(typeArgsLen), |
| 295 new IntLiteral(numArguments), | 298 new IntLiteral(numArguments), |
| 296 new IntLiteral(numPositionalArguments) | 299 new IntLiteral(numPositionalArguments) |
| 297 ]; | 300 ]; |
| 298 List<Expression> arguments = []; | 301 List<Expression> arguments = []; |
| 299 arguments.add(receiver); | 302 arguments.add(receiver); |
| 300 for (Expression pos in callArguments.positional) { | 303 for (Expression pos in callArguments.positional) { |
| 301 arguments.add(pos); | 304 arguments.add(pos); |
| 302 } | 305 } |
| 303 for (NamedExpression named in callArguments.named) { | 306 for (NamedExpression named in callArguments.named) { |
| 304 argumentsDescriptor.add(new StringLiteral(named.name)); | 307 argumentsDescriptor.add(new StringLiteral(named.name)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 return null; | 374 return null; |
| 372 } | 375 } |
| 373 } | 376 } |
| 374 | 377 |
| 375 throw new Exception( | 378 throw new Exception( |
| 376 'Could not find a generative constructor named "${constructor.name}" ' | 379 'Could not find a generative constructor named "${constructor.name}" ' |
| 377 'in lookup class "${lookupClass.name}"!'); | 380 'in lookup class "${lookupClass.name}"!'); |
| 378 } | 381 } |
| 379 } | 382 } |
| 380 } | 383 } |
| OLD | NEW |