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 /// This file declares a "shadow hierarchy" of concrete classes which extend | 5 /// This file declares a "shadow hierarchy" of concrete classes which extend |
6 /// the kernel class hierarchy, adding methods and fields needed by the | 6 /// the kernel class hierarchy, adding methods and fields needed by the |
7 /// BodyBuilder. | 7 /// BodyBuilder. |
8 /// | 8 /// |
9 /// Instances of these classes may be created using the factory methods in | 9 /// Instances of these classes may be created using the factory methods in |
10 /// `ast_factory.dart`. | 10 /// `ast_factory.dart`. |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 ? new InterfaceType(mapClass, [inferredKeyType, inferredValueType]) | 1027 ? new InterfaceType(mapClass, [inferredKeyType, inferredValueType]) |
1028 : null; | 1028 : null; |
1029 inferrer.listener.mapLiteralExit(this, inferredType); | 1029 inferrer.listener.mapLiteralExit(this, inferredType); |
1030 return inferredType; | 1030 return inferredType; |
1031 } | 1031 } |
1032 } | 1032 } |
1033 | 1033 |
1034 /// Shadow object for [MethodInvocation]. | 1034 /// Shadow object for [MethodInvocation]. |
1035 class KernelMethodInvocation extends MethodInvocation | 1035 class KernelMethodInvocation extends MethodInvocation |
1036 implements KernelExpression { | 1036 implements KernelExpression { |
| 1037 /// Indicates whether this method invocation is a call to a `call` method |
| 1038 /// resulting from the invocation of a function expression. |
| 1039 final bool _isImplicitCall; |
| 1040 |
1037 KernelMethodInvocation(Expression receiver, Name name, Arguments arguments, | 1041 KernelMethodInvocation(Expression receiver, Name name, Arguments arguments, |
1038 [Procedure interfaceTarget]) | 1042 {bool isImplicitCall: false, Procedure interfaceTarget}) |
1039 : super(receiver, name, arguments, interfaceTarget); | 1043 : _isImplicitCall = isImplicitCall, |
1040 | 1044 super(receiver, name, arguments, interfaceTarget); |
1041 KernelMethodInvocation.byReference(Expression receiver, Name name, | |
1042 Arguments arguments, Reference interfaceTargetReference) | |
1043 : super.byReference(receiver, name, arguments, interfaceTargetReference); | |
1044 | 1045 |
1045 @override | 1046 @override |
1046 void _collectDependencies(KernelDependencyCollector collector) { | 1047 void _collectDependencies(KernelDependencyCollector collector) { |
1047 // The inference dependencies are the inference dependencies of the | 1048 // The inference dependencies are the inference dependencies of the |
1048 // receiver. | 1049 // receiver. |
1049 collector.collectDependencies(receiver); | 1050 collector.collectDependencies(receiver); |
1050 } | 1051 } |
1051 | 1052 |
1052 @override | 1053 @override |
1053 DartType _inferExpression( | 1054 DartType _inferExpression( |
(...skipping 20 matching lines...) Expand all Loading... |
1074 // https://codereview.chromium.org/2923653003/. | 1075 // https://codereview.chromium.org/2923653003/. |
1075 if (interfaceMember is Procedure) { | 1076 if (interfaceMember is Procedure) { |
1076 interfaceTarget = interfaceMember; | 1077 interfaceTarget = interfaceMember; |
1077 } | 1078 } |
1078 } | 1079 } |
1079 if (interfaceMember is Procedure) { | 1080 if (interfaceMember is Procedure) { |
1080 isOverloadedArithmeticOperator = inferrer.typeSchemaEnvironment | 1081 isOverloadedArithmeticOperator = inferrer.typeSchemaEnvironment |
1081 .isOverloadedArithmeticOperator(interfaceMember); | 1082 .isOverloadedArithmeticOperator(interfaceMember); |
1082 } | 1083 } |
1083 } | 1084 } |
1084 var calleeType = | 1085 var calleeType = inferrer.getCalleeFunctionType( |
1085 inferrer.getCalleeFunctionType(interfaceMember, receiverType, name); | 1086 interfaceMember, receiverType, name, !_isImplicitCall); |
1086 var inferredType = inferrer.inferInvocation(typeContext, typeNeeded, | 1087 var inferredType = inferrer.inferInvocation(typeContext, typeNeeded, |
1087 fileOffset, calleeType, calleeType.returnType, arguments, | 1088 fileOffset, calleeType, calleeType.returnType, arguments, |
1088 isOverloadedArithmeticOperator: isOverloadedArithmeticOperator, | 1089 isOverloadedArithmeticOperator: isOverloadedArithmeticOperator, |
1089 receiverType: receiverType); | 1090 receiverType: receiverType); |
1090 inferrer.listener.methodInvocationExit(this, inferredType); | 1091 inferrer.listener.methodInvocationExit(this, inferredType); |
1091 return inferredType; | 1092 return inferredType; |
1092 } | 1093 } |
1093 } | 1094 } |
1094 | 1095 |
1095 /// Shadow object for [Not]. | 1096 /// Shadow object for [Not]. |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 } | 1941 } |
1941 | 1942 |
1942 transformChildren(v) { | 1943 transformChildren(v) { |
1943 return internalError("Internal error: Unsupported operation."); | 1944 return internalError("Internal error: Unsupported operation."); |
1944 } | 1945 } |
1945 | 1946 |
1946 visitChildren(v) { | 1947 visitChildren(v) { |
1947 return internalError("Internal error: Unsupported operation."); | 1948 return internalError("Internal error: Unsupported operation."); |
1948 } | 1949 } |
1949 } | 1950 } |
OLD | NEW |