Chromium Code Reviews| 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..caa34a7cc6dfd975f0cb4512b2d29ad2de22d5f6 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 |
| @@ -5147,15 +5112,10 @@ class FunctionExpressionInvocationImpl extends ExpressionImpl |
| } |
| @override |
| - int get precedence => 15; |
| - |
| - @override |
| - TypeArgumentList get typeArguments => _typeArguments; |
| + Expression get invocationTarget => function; |
| @override |
| - void set typeArguments(TypeArgumentList typeArguments) { |
| - _typeArguments = _becomeParentOf(typeArguments); |
| - } |
| + int get precedence => 15; |
| @override |
| accept(AstVisitor visitor) => visitor.visitFunctionExpressionInvocation(this); |
| @@ -6167,6 +6127,55 @@ class InterpolationStringImpl extends InterpolationElementImpl |
| } |
| /** |
| + * Common base class for [FunctionExpressionInvocationImpl] and |
| + * [MethodInvocationImpl]. |
| + */ |
| +abstract class InvocationExpressionImpl extends ExpressionImpl |
| + implements InvocationExpression { |
| + @override |
| + DartType staticInvokeType; |
| + |
| + @override |
| + DartType propagatedInvokeType; |
|
Brian Wilkerson
2016/02/22 22:13:26
nit: We generally (always?) place non-AstNode type
Jennifer Messerly
2016/02/22 22:45:55
Sorry about that. I didn't realize that "sort memb
|
| + |
| + /** |
| + * 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; |
| + |
| + /** |
| + * 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 +6968,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 +6990,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 +6998,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 +7025,9 @@ class MethodInvocationImpl extends ExpressionImpl implements MethodInvocation { |
| Token get endToken => _argumentList.endToken; |
| @override |
| + Expression get invocationTarget => methodName; |
| + |
| + @override |
| bool get isCascaded => |
| operator != null && operator.type == TokenType.PERIOD_PERIOD; |
| @@ -7088,14 +7066,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 |