Index: pkg/analyzer/lib/src/dart/ast/ast.dart |
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart |
index 4a9826ee757dc032867fbdddfca18f88e424ee9c..6357be298e20fdce81f957919e638f1737288aaf 100644 |
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart |
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart |
@@ -5054,7 +5054,7 @@ class FunctionExpressionImpl extends ExpressionImpl |
* > functionExpressionInvocation ::= |
* > [Expression] [TypeArgumentList]? [ArgumentList] |
*/ |
-class FunctionExpressionInvocationImpl extends ExpressionImpl |
+class FunctionExpressionInvocationImpl extends InvocationExpressionImpl |
implements FunctionExpressionInvocation { |
/** |
* The expression producing the function being invoked. |
@@ -5062,17 +5062,6 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl |
Expression _function; |
/** |
- * The type arguments to be applied to the method being invoked, or `null` if |
- * no type arguments were provided. |
- */ |
- TypeArgumentList _typeArguments; |
- |
- /** |
- * The list of arguments to the function. |
- */ |
- ArgumentList _argumentList; |
- |
- /** |
* The element associated with the function being invoked based on static type |
* information, or `null` if the AST structure has not been resolved or the |
* function could not be resolved. |
@@ -5080,16 +5069,6 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl |
ExecutableElement staticElement; |
/** |
- * The function type of the method invocation, or `null` if the AST |
- * structure has not been resolved, or if the invoke could not be resolved. |
- * |
- * This will usually be a [FunctionType], but it can also be an |
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
- * interface type that implements `Function`. |
- */ |
- DartType staticInvokeType; |
- |
- /** |
* The element associated with the function being invoked based on propagated |
* type information, or `null` if the AST structure has not been resolved or |
* the function could not be resolved. |
@@ -5097,26 +5076,12 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl |
ExecutableElement propagatedElement; |
/** |
- * Like [staticInvokeType], but reflects propagated type information. |
- */ |
- DartType propagatedInvokeType; |
- |
- /** |
* Initialize a newly created function expression invocation. |
*/ |
FunctionExpressionInvocationImpl(Expression function, |
- TypeArgumentList typeArguments, ArgumentList argumentList) { |
+ TypeArgumentList typeArguments, ArgumentList argumentList) |
+ : super(typeArguments, argumentList) { |
_function = _becomeParentOf(function); |
- _typeArguments = _becomeParentOf(typeArguments); |
- _argumentList = _becomeParentOf(argumentList); |
- } |
- |
- @override |
- ArgumentList get argumentList => _argumentList; |
- |
- @override |
- void set argumentList(ArgumentList argumentList) { |
- _argumentList = _becomeParentOf(argumentList); |
} |
@override |
@@ -5150,14 +5115,6 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl |
int get precedence => 15; |
@override |
- TypeArgumentList get typeArguments => _typeArguments; |
- |
- @override |
- void set typeArguments(TypeArgumentList typeArguments) { |
- _typeArguments = _becomeParentOf(typeArguments); |
- } |
- |
- @override |
accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
@override |
@@ -6167,6 +6124,55 @@ class InterpolationStringImpl extends InterpolationElementImpl |
} |
/** |
+ * Common base class for [FunctionExpressionInvocationImpl] and |
+ * [MethodInvocationImpl]. |
+ */ |
+abstract class InvocationExpressionImpl extends ExpressionImpl |
+ implements InvocationExpression { |
+ /** |
+ * The type arguments to be applied to the method being invoked, or `null` if |
+ * no type arguments were provided. |
+ */ |
+ TypeArgumentList _typeArguments; |
+ |
+ /** |
+ * The list of arguments to the function. |
+ */ |
+ ArgumentList _argumentList; |
+ |
+ @override |
+ DartType propagatedInvokeType; |
+ |
+ @override |
+ DartType staticInvokeType; |
+ |
+ /** |
+ * Initialize a newly created invocation. |
+ */ |
+ InvocationExpressionImpl( |
+ TypeArgumentList typeArguments, ArgumentList argumentList) { |
+ _typeArguments = _becomeParentOf(typeArguments); |
+ _argumentList = _becomeParentOf(argumentList); |
+ } |
+ |
+ @override |
+ ArgumentList get argumentList => _argumentList; |
+ |
+ @override |
+ void set argumentList(ArgumentList argumentList) { |
+ _argumentList = _becomeParentOf(argumentList); |
+ } |
+ |
+ @override |
+ TypeArgumentList get typeArguments => _typeArguments; |
+ |
+ @override |
+ void set typeArguments(TypeArgumentList typeArguments) { |
+ _typeArguments = _becomeParentOf(typeArguments); |
+ } |
+} |
+ |
+/** |
* An is expression. |
* |
* > isExpression ::= |
@@ -6959,7 +6965,8 @@ class MethodDeclarationImpl extends ClassMemberImpl |
* > methodInvocation ::= |
* > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentList] |
*/ |
-class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
+class MethodInvocationImpl extends InvocationExpressionImpl |
+ implements MethodInvocation { |
/** |
* The expression producing the object on which the method is defined, or |
* `null` if there is no target (that is, the target is implicitly `this`). |
@@ -6980,32 +6987,6 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
SimpleIdentifier _methodName; |
/** |
- * The type arguments to be applied to the method being invoked, or `null` if |
- * no type arguments were provided. |
- */ |
- TypeArgumentList _typeArguments; |
- |
- /** |
- * The list of arguments to the method. |
- */ |
- ArgumentList _argumentList; |
- |
- /** |
- * The function type of the method invocation, or `null` if the AST |
- * structure has not been resolved, or if the invoke could not be resolved. |
- * |
- * This will usually be a [FunctionType], but it can also be an |
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy` |
- * interface type that implements `Function`. |
- */ |
- DartType staticInvokeType; |
- |
- /** |
- * Like [staticInvokeType], but reflects propagated type information. |
- */ |
- DartType propagatedInvokeType; |
- |
- /** |
* Initialize a newly created method invocation. The [target] and [operator] |
* can be `null` if there is no target. |
*/ |
@@ -7014,19 +6995,10 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
this.operator, |
SimpleIdentifier methodName, |
TypeArgumentList typeArguments, |
- ArgumentList argumentList) { |
+ ArgumentList argumentList) |
+ : super(typeArguments, argumentList) { |
_target = _becomeParentOf(target); |
_methodName = _becomeParentOf(methodName); |
- _typeArguments = _becomeParentOf(typeArguments); |
- _argumentList = _becomeParentOf(argumentList); |
- } |
- |
- @override |
- ArgumentList get argumentList => _argumentList; |
- |
- @override |
- void set argumentList(ArgumentList argumentList) { |
- _argumentList = _becomeParentOf(argumentList); |
} |
@override |
@@ -7050,6 +7022,9 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
Token get endToken => _argumentList.endToken; |
@override |
+ Expression get function => methodName; |
+ |
+ @override |
bool get isCascaded => |
operator != null && operator.type == TokenType.PERIOD_PERIOD; |
@@ -7088,14 +7063,6 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
} |
@override |
- TypeArgumentList get typeArguments => _typeArguments; |
- |
- @override |
- void set typeArguments(TypeArgumentList typeArguments) { |
- _typeArguments = _becomeParentOf(typeArguments); |
- } |
- |
- @override |
accept(AstVisitor visitor) => visitor.visitMethodInvocation(this); |
@override |