| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 kernel.transformations.method_call; | 5 library kernel.transformations.method_call; |
| 6 | 6 |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 | 8 |
| 9 import '../ast.dart'; | 9 import '../ast.dart'; |
| 10 import '../class_hierarchy.dart'; | 10 import '../class_hierarchy.dart'; |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 // Mark the new procedure as visited already (i.e. don't rewrite it again!) | 883 // Mark the new procedure as visited already (i.e. don't rewrite it again!) |
| 884 _visited.add(procedure); | 884 _visited.add(procedure); |
| 885 | 885 |
| 886 return procedure; | 886 return procedure; |
| 887 } | 887 } |
| 888 | 888 |
| 889 /// Creates an "new _InvocationMirror(...)" invocation. | 889 /// Creates an "new _InvocationMirror(...)" invocation. |
| 890 ConstructorInvocation _createInvocation( | 890 ConstructorInvocation _createInvocation( |
| 891 String methodName, Arguments callArguments) { | 891 String methodName, Arguments callArguments) { |
| 892 if (_invocationMirrorConstructor == null) { | 892 if (_invocationMirrorConstructor == null) { |
| 893 Class clazz = coreTypes.getClass('dart:core', '_InvocationMirror'); | 893 Class clazz = coreTypes.invocationMirrorClass; |
| 894 _invocationMirrorConstructor = clazz.constructors[0]; | 894 _invocationMirrorConstructor = clazz.constructors[0]; |
| 895 } | 895 } |
| 896 | 896 |
| 897 // The _InvocationMirror constructor takes the following arguments: | 897 // The _InvocationMirror constructor takes the following arguments: |
| 898 // * Method name (a string). | 898 // * Method name (a string). |
| 899 // * An arguments descriptor - a list consisting of: | 899 // * An arguments descriptor - a list consisting of: |
| 900 // - number of arguments (including receiver). | 900 // - number of arguments (including receiver). |
| 901 // - number of positional arguments (including receiver). | 901 // - number of positional arguments (including receiver). |
| 902 // - pairs (2 entries in the list) of | 902 // - pairs (2 entries in the list) of |
| 903 // * named arguments name. | 903 // * named arguments name. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 927 new Arguments([ | 927 new Arguments([ |
| 928 new StringLiteral(methodName), | 928 new StringLiteral(methodName), |
| 929 _fixedLengthList(argumentsDescriptor), | 929 _fixedLengthList(argumentsDescriptor), |
| 930 _fixedLengthList(arguments), | 930 _fixedLengthList(arguments), |
| 931 new BoolLiteral(false) | 931 new BoolLiteral(false) |
| 932 ])); | 932 ])); |
| 933 } | 933 } |
| 934 | 934 |
| 935 /// Create a fixed length list containing given expressions. | 935 /// Create a fixed length list containing given expressions. |
| 936 Expression _fixedLengthList(List<Expression> list) { | 936 Expression _fixedLengthList(List<Expression> list) { |
| 937 _listFrom ??= coreTypes.getMember('dart:core', 'List', 'from'); | 937 _listFrom ??= coreTypes.listFromConstructor; |
| 938 return new StaticInvocation( | 938 return new StaticInvocation( |
| 939 _listFrom, | 939 _listFrom, |
| 940 new Arguments([new ListLiteral(list)], | 940 new Arguments([new ListLiteral(list)], |
| 941 named: [new NamedExpression("growable", new BoolLiteral(false))], | 941 named: [new NamedExpression("growable", new BoolLiteral(false))], |
| 942 types: [const DynamicType()])); | 942 types: [const DynamicType()])); |
| 943 } | 943 } |
| 944 | 944 |
| 945 /// Creates a new procedure taking given arguments, caching it. | 945 /// Creates a new procedure taking given arguments, caching it. |
| 946 /// | 946 /// |
| 947 /// Copies any non-given default values for parameters into the new procedure | 947 /// Copies any non-given default values for parameters into the new procedure |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 return printStackTrace; | 1306 return printStackTrace; |
| 1307 } | 1307 } |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 class _Pair<K, V> { | 1310 class _Pair<K, V> { |
| 1311 final K key; | 1311 final K key; |
| 1312 final V value; | 1312 final V value; |
| 1313 | 1313 |
| 1314 _Pair(this.key, this.value); | 1314 _Pair(this.key, this.value); |
| 1315 } | 1315 } |
| OLD | NEW |