@@ -5054,69 +5054,34 @@ class FunctionExpressionImpl extends ExpressionImpl
5054
5054
* > functionExpressionInvocation ::=
5055
5055
* > [Expression] [TypeArgumentList] ? [ArgumentList]
5056
5056
*/
5057
- class FunctionExpressionInvocationImpl extends ExpressionImpl
5057
+ class FunctionExpressionInvocationImpl extends InvocationExpressionImpl
5058
5058
implements FunctionExpressionInvocation {
5059
5059
/**
5060
5060
* The expression producing the function being invoked.
5061
5061
*/
5062
5062
Expression _function;
5063
5063
5064
- /**
5065
- * The type arguments to be applied to the method being invoked, or `null` if
5066
- * no type arguments were provided.
5067
- */
5068
- TypeArgumentList _typeArguments;
5069
-
5070
- /**
5071
- * The list of arguments to the function.
5072
- */
5073
- ArgumentList _argumentList;
5074
-
5075
5064
/**
5076
5065
* The element associated with the function being invoked based on static type
5077
5066
* information, or `null` if the AST structure has not been resolved or the
5078
5067
* function could not be resolved.
5079
5068
*/
5080
5069
ExecutableElement staticElement;
5081
5070
5082
- /**
5083
- * The function type of the method invocation, or `null` if the AST
5084
- * structure has not been resolved, or if the invoke could not be resolved.
5085
- *
5086
- * This will usually be a [FunctionType] , but it can also be an
5087
- * [InterfaceType] with a `call` method, `dynamic` , `Function` , or a `@proxy`
5088
- * interface type that implements `Function` .
5089
- */
5090
- DartType staticInvokeType;
5091
-
5092
5071
/**
5093
5072
* The element associated with the function being invoked based on propagated
5094
5073
* type information, or `null` if the AST structure has not been resolved or
5095
5074
* the function could not be resolved.
5096
5075
*/
5097
5076
ExecutableElement propagatedElement;
5098
5077
5099
- /**
5100
- * Like [staticInvokeType] , but reflects propagated type information.
5101
- */
5102
- DartType propagatedInvokeType;
5103
-
5104
5078
/**
5105
5079
* Initialize a newly created function expression invocation.
5106
5080
*/
5107
5081
FunctionExpressionInvocationImpl (Expression function,
5108
- TypeArgumentList typeArguments, ArgumentList argumentList) {
5082
+ TypeArgumentList typeArguments, ArgumentList argumentList)
5083
+ : super (typeArguments, argumentList) {
5109
5084
_function = _becomeParentOf (function);
5110
- _typeArguments = _becomeParentOf (typeArguments);
5111
- _argumentList = _becomeParentOf (argumentList);
5112
- }
5113
-
5114
- @override
5115
- ArgumentList get argumentList => _argumentList;
5116
-
5117
- @override
5118
- void set argumentList (ArgumentList argumentList) {
5119
- _argumentList = _becomeParentOf (argumentList);
5120
5085
}
5121
5086
5122
5087
@override
@@ -5149,14 +5114,6 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl
5149
5114
@override
5150
5115
int get precedence => 15 ;
5151
5116
5152
- @override
5153
- TypeArgumentList get typeArguments => _typeArguments;
5154
-
5155
- @override
5156
- void set typeArguments (TypeArgumentList typeArguments) {
5157
- _typeArguments = _becomeParentOf (typeArguments);
5158
- }
5159
-
5160
5117
@override
5161
5118
accept (AstVisitor visitor) => visitor.visitFunctionExpressionInvocation (this );
5162
5119
@@ -6166,6 +6123,55 @@ class InterpolationStringImpl extends InterpolationElementImpl
6166
6123
void visitChildren (AstVisitor visitor) {}
6167
6124
}
6168
6125
6126
+ /**
6127
+ * Common base class for [FunctionExpressionInvocationImpl] and
6128
+ * [MethodInvocationImpl] .
6129
+ */
6130
+ abstract class InvocationExpressionImpl extends ExpressionImpl
6131
+ implements InvocationExpression {
6132
+ /**
6133
+ * The type arguments to be applied to the method being invoked, or `null` if
6134
+ * no type arguments were provided.
6135
+ */
6136
+ TypeArgumentList _typeArguments;
6137
+
6138
+ /**
6139
+ * The list of arguments to the function.
6140
+ */
6141
+ ArgumentList _argumentList;
6142
+
6143
+ @override
6144
+ DartType propagatedInvokeType;
6145
+
6146
+ @override
6147
+ DartType staticInvokeType;
6148
+
6149
+ /**
6150
+ * Initialize a newly created invocation.
6151
+ */
6152
+ InvocationExpressionImpl (
6153
+ TypeArgumentList typeArguments, ArgumentList argumentList) {
6154
+ _typeArguments = _becomeParentOf (typeArguments);
6155
+ _argumentList = _becomeParentOf (argumentList);
6156
+ }
6157
+
6158
+ @override
6159
+ ArgumentList get argumentList => _argumentList;
6160
+
6161
+ @override
6162
+ void set argumentList (ArgumentList argumentList) {
6163
+ _argumentList = _becomeParentOf (argumentList);
6164
+ }
6165
+
6166
+ @override
6167
+ TypeArgumentList get typeArguments => _typeArguments;
6168
+
6169
+ @override
6170
+ void set typeArguments (TypeArgumentList typeArguments) {
6171
+ _typeArguments = _becomeParentOf (typeArguments);
6172
+ }
6173
+ }
6174
+
6169
6175
/**
6170
6176
* An is expression.
6171
6177
*
@@ -6959,7 +6965,8 @@ class MethodDeclarationImpl extends ClassMemberImpl
6959
6965
* > methodInvocation ::=
6960
6966
* > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList] ? [ArgumentList]
6961
6967
*/
6962
- class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation {
6968
+ class MethodInvocationImpl extends InvocationExpressionImpl
6969
+ implements MethodInvocation {
6963
6970
/**
6964
6971
* The expression producing the object on which the method is defined, or
6965
6972
* `null` if there is no target (that is, the target is implicitly `this` ).
@@ -6979,32 +6986,6 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation {
6979
6986
*/
6980
6987
SimpleIdentifier _methodName;
6981
6988
6982
- /**
6983
- * The type arguments to be applied to the method being invoked, or `null` if
6984
- * no type arguments were provided.
6985
- */
6986
- TypeArgumentList _typeArguments;
6987
-
6988
- /**
6989
- * The list of arguments to the method.
6990
- */
6991
- ArgumentList _argumentList;
6992
-
6993
- /**
6994
- * The function type of the method invocation, or `null` if the AST
6995
- * structure has not been resolved, or if the invoke could not be resolved.
6996
- *
6997
- * This will usually be a [FunctionType] , but it can also be an
6998
- * [InterfaceType] with a `call` method, `dynamic` , `Function` , or a `@proxy`
6999
- * interface type that implements `Function` .
7000
- */
7001
- DartType staticInvokeType;
7002
-
7003
- /**
7004
- * Like [staticInvokeType] , but reflects propagated type information.
7005
- */
7006
- DartType propagatedInvokeType;
7007
-
7008
6989
/**
7009
6990
* Initialize a newly created method invocation. The [target] and [operator]
7010
6991
* can be `null` if there is no target.
@@ -7014,19 +6995,10 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation {
7014
6995
this .operator ,
7015
6996
SimpleIdentifier methodName,
7016
6997
TypeArgumentList typeArguments,
7017
- ArgumentList argumentList) {
6998
+ ArgumentList argumentList)
6999
+ : super (typeArguments, argumentList) {
7018
7000
_target = _becomeParentOf (target);
7019
7001
_methodName = _becomeParentOf (methodName);
7020
- _typeArguments = _becomeParentOf (typeArguments);
7021
- _argumentList = _becomeParentOf (argumentList);
7022
- }
7023
-
7024
- @override
7025
- ArgumentList get argumentList => _argumentList;
7026
-
7027
- @override
7028
- void set argumentList (ArgumentList argumentList) {
7029
- _argumentList = _becomeParentOf (argumentList);
7030
7002
}
7031
7003
7032
7004
@override
@@ -7049,6 +7021,9 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation {
7049
7021
@override
7050
7022
Token get endToken => _argumentList.endToken;
7051
7023
7024
+ @override
7025
+ Expression get function => methodName;
7026
+
7052
7027
@override
7053
7028
bool get isCascaded =>
7054
7029
operator != null && operator .type == TokenType .PERIOD_PERIOD ;
@@ -7087,14 +7062,6 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation {
7087
7062
_target = _becomeParentOf (expression);
7088
7063
}
7089
7064
7090
- @override
7091
- TypeArgumentList get typeArguments => _typeArguments;
7092
-
7093
- @override
7094
- void set typeArguments (TypeArgumentList typeArguments) {
7095
- _typeArguments = _becomeParentOf (typeArguments);
7096
- }
7097
-
7098
7065
@override
7099
7066
accept (AstVisitor visitor) => visitor.visitMethodInvocation (this );
7100
7067
0 commit comments