Chromium Code Reviews| Index: pkg/analyzer/lib/dart/ast/ast.dart |
| diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart |
| index 851890c32e35a364c0dcd8210029a53a0da3d6a7..75556882c10eabbb6736e4a6db5afdd1913d0313 100644 |
| --- a/pkg/analyzer/lib/dart/ast/ast.dart |
| +++ b/pkg/analyzer/lib/dart/ast/ast.dart |
| @@ -461,7 +461,8 @@ abstract class AssertStatement implements Assertion, Statement { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class AssignmentExpression extends Expression { |
| +abstract class AssignmentExpression extends Expression |
| + implements MethodReferenceExpression { |
| /** |
| * Initialize a newly created assignment expression. |
| */ |
| @@ -470,15 +471,6 @@ abstract class AssignmentExpression extends Expression { |
| new AssignmentExpressionImpl(leftHandSide, operator, rightHandSide); |
| /** |
| - * Return the best element available for this operator. If resolution was able |
| - * to find a better element based on type propagation, that element will be |
| - * returned. Otherwise, the element found using the result of static analysis |
| - * will be returned. If resolution has not been performed, then `null` will be |
| - * returned. |
| - */ |
| - MethodElement get bestElement; |
| - |
| - /** |
| * Return the expression used to compute the left hand side. |
| */ |
| Expression get leftHandSide; |
| @@ -499,20 +491,6 @@ abstract class AssignmentExpression extends Expression { |
| void set operator(Token token); |
| /** |
| - * Return the element associated with the operator based on the propagated |
| - * type of the left-hand-side, or `null` if the AST structure has not been |
| - * resolved, if the operator is not a compound operator, or if the operator |
| - * could not be resolved. |
| - */ |
| - MethodElement get propagatedElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the propagated |
| - * type of the left-hand-side to the given [element]. |
| - */ |
| - void set propagatedElement(MethodElement element); |
| - |
| - /** |
| * Return the expression used to compute the right hand side. |
| */ |
| Expression get rightHandSide; |
| @@ -522,20 +500,6 @@ abstract class AssignmentExpression extends Expression { |
| * [expression]. |
| */ |
| void set rightHandSide(Expression expression); |
| - |
| - /** |
| - * Return the element associated with the operator based on the static type of |
| - * the left-hand-side, or `null` if the AST structure has not been resolved, |
| - * if the operator is not a compound operator, or if the operator could not be |
| - * resolved. |
| - */ |
| - MethodElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the static type of |
| - * the left-hand-side to the given [element]. |
| - */ |
| - void set staticElement(MethodElement element); |
| } |
| /** |
| @@ -926,7 +890,8 @@ abstract class AwaitExpression extends Expression { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class BinaryExpression extends Expression { |
| +abstract class BinaryExpression extends Expression |
| + implements MethodReferenceExpression { |
| /** |
| * Initialize a newly created binary expression. |
| */ |
| @@ -935,15 +900,6 @@ abstract class BinaryExpression extends Expression { |
| new BinaryExpressionImpl(leftOperand, operator, rightOperand); |
| /** |
| - * Return the best element available for this operator. If resolution was able |
| - * to find a better element based on type propagation, that element will be |
| - * returned. Otherwise, the element found using the result of static analysis |
| - * will be returned. If resolution has not been performed, then `null` will be |
| - * returned. |
| - */ |
| - MethodElement get bestElement; |
| - |
| - /** |
| * Return the expression used to compute the left operand. |
| */ |
| Expression get leftOperand; |
| @@ -965,20 +921,6 @@ abstract class BinaryExpression extends Expression { |
| void set operator(Token token); |
| /** |
| - * Return the element associated with the operator based on the propagated |
| - * type of the left operand, or `null` if the AST structure has not been |
| - * resolved, if the operator is not user definable, or if the operator could |
| - * not be resolved. |
| - */ |
| - MethodElement get propagatedElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the propagated |
| - * type of the left operand to the given [element]. |
| - */ |
| - void set propagatedElement(MethodElement element); |
| - |
| - /** |
| * Return the expression used to compute the right operand. |
| */ |
| Expression get rightOperand; |
| @@ -988,20 +930,6 @@ abstract class BinaryExpression extends Expression { |
| * [expression]. |
| */ |
| void set rightOperand(Expression expression); |
| - |
| - /** |
| - * Return the element associated with the operator based on the static type of |
| - * the left operand, or `null` if the AST structure has not been resolved, if |
| - * the operator is not user definable, or if the operator could not be |
| - * resolved. |
| - */ |
| - MethodElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the static type of |
| - * the left operand to the given [element]. |
| - */ |
| - void set staticElement(MethodElement element); |
| } |
| /** |
| @@ -2429,7 +2357,8 @@ abstract class ConstructorInitializer extends AstNode {} |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class ConstructorName extends AstNode { |
| +abstract class ConstructorName extends AstNode |
| + implements ConstructorReferenceNode { |
| /** |
| * Initialize a newly created constructor name. The [period] and [name] can be |
| * `null` if the constructor being named is the unnamed constructor. |
| @@ -2461,27 +2390,34 @@ abstract class ConstructorName extends AstNode { |
| void set period(Token token); |
| /** |
| - * Return the element associated with this constructor name based on static |
| - * type information, or `null` if the AST structure has not been resolved or |
| - * if this constructor name could not be resolved. |
| + * Return the name of the type defining the constructor. |
| */ |
| - ConstructorElement get staticElement; |
| + TypeName get type; |
| /** |
| - * Set the element associated with this constructor name based on static type |
| - * information to the given [element]. |
| + * Set the name of the type defining the constructor to the given [type] name. |
| */ |
| - void set staticElement(ConstructorElement element); |
| + void set type(TypeName type); |
| +} |
| +/** |
| + * An AST node which makes reference to a constructor. |
|
Brian Wilkerson
2016/11/29 18:07:28
"which" --> "that"
Paul Berry
2016/11/29 18:11:03
Done.
|
| + * |
| + * Clients may not extend, implement or mix-in this class. |
| + */ |
| +abstract class ConstructorReferenceNode { |
| /** |
| - * Return the name of the type defining the constructor. |
| + * Return the element associated with the referenced constructor based on |
| + * static type information, or `null` if the AST structure has not been |
| + * resolved or if the constructor could not be resolved. |
| */ |
| - TypeName get type; |
| + ConstructorElement get staticElement; |
| /** |
| - * Set the name of the type defining the constructor to the given [type] name. |
| + * Set the element associated with the referenced constructor based on static |
| + * type information to the given [element]. |
| */ |
| - void set type(TypeName type); |
| + void set staticElement(ConstructorElement element); |
| } |
| /** |
| @@ -4192,25 +4128,6 @@ abstract class FunctionExpressionInvocation extends InvocationExpression { |
| void set propagatedElement(ExecutableElement element); |
| /** |
| - * Return the function type of the method invocation based on the propagated |
| - * type information, 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`. |
| - */ |
| - @override |
| - DartType get propagatedInvokeType; |
| - |
| - /** |
| - * Set the function type of the method invocation based on the propagated type |
| - * information to the given [type]. |
| - */ |
| - @override |
| - void set propagatedInvokeType(DartType type); |
| - |
| - /** |
| * Return 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. |
| @@ -4224,25 +4141,6 @@ abstract class FunctionExpressionInvocation extends InvocationExpression { |
| void set staticElement(ExecutableElement element); |
| /** |
| - * Return the function type of the method invocation based on the static type |
| - * information, 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`. |
| - */ |
| - @override |
| - DartType get staticInvokeType; |
| - |
| - /** |
| - * Set the function type of the method invocation based on the static type |
| - * information to the given [type]. |
| - */ |
| - @override |
| - void set staticInvokeType(DartType type); |
| - |
| - /** |
| * Set the type arguments to be applied to the method being invoked to the |
| * given [typeArguments]. |
| */ |
| @@ -4781,7 +4679,8 @@ abstract class ImportDirective extends NamespaceDirective { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class IndexExpression extends Expression { |
| +abstract class IndexExpression extends Expression |
| + implements MethodReferenceExpression { |
| /** |
| * Initialize a newly created index expression. |
| */ |
| @@ -4815,15 +4714,6 @@ abstract class IndexExpression extends Expression { |
| void set auxiliaryElements(AuxiliaryElements elements); |
| /** |
| - * Return the best element available for this operator. If resolution was able |
| - * to find a better element based on type propagation, that element will be |
| - * returned. Otherwise, the element found using the result of static analysis |
| - * will be returned. If resolution has not been performed, then `null` will be |
| - * returned. |
| - */ |
| - MethodElement get bestElement; |
| - |
| - /** |
| * Return the expression used to compute the index. |
| */ |
| Expression get index; |
| @@ -4863,19 +4753,6 @@ abstract class IndexExpression extends Expression { |
| void set period(Token token); |
| /** |
| - * Return the element associated with the operator based on the propagated |
| - * type of the target, or `null` if the AST structure has not been resolved or |
| - * if the operator could not be resolved. |
| - */ |
| - MethodElement get propagatedElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the propagated |
| - * type of the target to the given [element]. |
| - */ |
| - void set propagatedElement(MethodElement element); |
| - |
| - /** |
| * Return the expression used to compute the object being indexed. If this |
| * index expression is not part of a cascade expression, then this is the same |
| * as [target]. If this index expression is part of a cascade expression, then |
| @@ -4889,19 +4766,6 @@ abstract class IndexExpression extends Expression { |
| Token get rightBracket; |
| /** |
| - * Return the element associated with the operator based on the static type of |
| - * the target, or `null` if the AST structure has not been resolved or if the |
| - * operator could not be resolved. |
| - */ |
| - MethodElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the static type of |
| - * the target to the given [element]. |
| - */ |
| - void set staticElement(MethodElement element); |
| - |
| - /** |
| * Return the expression used to compute the object being indexed, or `null` |
| * if this index expression is part of a cascade expression. |
| * |
| @@ -4949,7 +4813,8 @@ abstract class IndexExpression extends Expression { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class InstanceCreationExpression extends Expression { |
| +abstract class InstanceCreationExpression extends Expression |
| + implements ConstructorReferenceNode { |
| /** |
| * Initialize a newly created instance creation expression. |
| */ |
| @@ -4995,19 +4860,6 @@ abstract class InstanceCreationExpression extends Expression { |
| * created to the given [token]. |
| */ |
| void set keyword(Token token); |
| - |
| - /** |
| - * Return the element associated with the constructor based on static type |
| - * information, or `null` if the AST structure has not been resolved or if the |
| - * constructor could not be resolved. |
| - */ |
| - ConstructorElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the constructor based on static type |
| - * information to the given [element]. |
| - */ |
| - void set staticElement(ConstructorElement element); |
| } |
| /** |
| @@ -5838,25 +5690,6 @@ abstract class MethodInvocation extends InvocationExpression { |
| void set operator(Token token); |
| /** |
| - * Return the function type of the method invocation based on the propagated |
| - * type information, 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`. |
| - */ |
| - @override |
| - DartType get propagatedInvokeType; |
| - |
| - /** |
| - * Set the function type of the method invocation based on the propagated type |
| - * information to the given [type]. |
| - */ |
| - @override |
| - void set propagatedInvokeType(DartType type); |
| - |
| - /** |
| * Return the expression used to compute the receiver of the invocation. If |
| * this invocation is not part of a cascade expression, then this is the same |
| * as [target]. If this invocation is part of a cascade expression, then the |
| @@ -5865,25 +5698,6 @@ abstract class MethodInvocation extends InvocationExpression { |
| Expression get realTarget; |
| /** |
| - * Return the function type of the method invocation based on the static type |
| - * information, 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`. |
| - */ |
| - @override |
| - DartType get staticInvokeType; |
| - |
| - /** |
| - * Set the function type of the method invocation based on the static type |
| - * information to the given [type]. |
| - */ |
| - @override |
| - void set staticInvokeType(DartType type); |
| - |
| - /** |
| * Return 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`) |
| * or if this method invocation is part of a cascade expression. |
| @@ -5907,6 +5721,52 @@ abstract class MethodInvocation extends InvocationExpression { |
| } |
| /** |
| + * An expression which implicity makes reference to a method. |
|
Brian Wilkerson
2016/11/29 18:07:28
"which" --> "that"
Paul Berry
2016/11/29 18:11:03
Done.
|
| + * |
| + * Clients may not extend, implement or mix-in this class. |
| + */ |
| +abstract class MethodReferenceExpression { |
| + /** |
| + * Return the best element available for this expression. If resolution was |
| + * able to find a better element based on type propagation, that element will |
| + * be returned. Otherwise, the element found using the result of static |
| + * analysis will be returned. If resolution has not been performed, then |
| + * `null` will be returned. |
| + */ |
| + MethodElement get bestElement; |
| + |
| + /** |
| + * Return the element associated with the expression based on propagated |
| + * types, or `null` if the AST structure has not been resolved, or there is |
| + * no meaningful propagated element to return (e.g. because this is a |
| + * non-compound assignment expression, or because the method referred to could |
| + * not be resolved). |
| + */ |
| + MethodElement get propagatedElement; |
| + |
| + /** |
| + * Set the element associated with the expression based on propagated types to |
| + * the given [element]. |
| + */ |
| + void set propagatedElement(MethodElement element); |
| + |
| + /** |
| + * Return the element associated with the expression based on the static |
| + * types, or `null` if the AST structure has not been resolved, or there is no |
| + * meaningful static element to return (e.g. because this is a non-compound |
| + * assignment expression, or because the method referred to could not be |
| + * resolved). |
| + */ |
| + MethodElement get staticElement; |
| + |
| + /** |
| + * Set the element associated with the expression based on static types to the |
| + * given [element]. |
| + */ |
| + void set staticElement(MethodElement element); |
| +} |
| + |
| +/** |
| * A node that declares a single name within the scope of a compilation unit. |
| * |
| * Clients may not extend, implement or mix-in this class. |
| @@ -6417,7 +6277,8 @@ abstract class PartOfDirective extends Directive { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class PostfixExpression extends Expression { |
| +abstract class PostfixExpression extends Expression |
| + implements MethodReferenceExpression { |
| /** |
| * Initialize a newly created postfix expression. |
| */ |
| @@ -6425,15 +6286,6 @@ abstract class PostfixExpression extends Expression { |
| new PostfixExpressionImpl(operand, operator); |
| /** |
| - * Return the best element available for this operator. If resolution was able |
| - * to find a better element based on type propagation, that element will be |
| - * returned. Otherwise, the element found using the result of static analysis |
| - * will be returned. If resolution has not been performed, then `null` will be |
| - * returned. |
| - */ |
| - MethodElement get bestElement; |
| - |
| - /** |
| * Return the expression computing the operand for the operator. |
| */ |
| Expression get operand; |
| @@ -6453,33 +6305,6 @@ abstract class PostfixExpression extends Expression { |
| * Set the postfix operator being applied to the operand to the given [token]. |
| */ |
| void set operator(Token token); |
| - |
| - /** |
| - * Return the element associated with this the operator based on the |
| - * propagated type of the operand, or `null` if the AST structure has not been |
| - * resolved, if the operator is not user definable, or if the operator could |
| - * not be resolved. |
| - */ |
| - MethodElement get propagatedElement; |
| - |
| - /** |
| - * Set the element associated with this the operator based on the propagated |
| - * type of the operand to the given [element]. |
| - */ |
| - void set propagatedElement(MethodElement element); |
| - |
| - /** |
| - * Return the element associated with the operator based on the static type of |
| - * the operand, or `null` if the AST structure has not been resolved, if the |
| - * operator is not user definable, or if the operator could not be resolved. |
| - */ |
| - MethodElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the static type of |
| - * the operand to the given [element]. |
| - */ |
| - void set staticElement(MethodElement element); |
| } |
| /** |
| @@ -6550,7 +6375,8 @@ abstract class PrefixedIdentifier extends Identifier { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class PrefixExpression extends Expression { |
| +abstract class PrefixExpression extends Expression |
| + implements MethodReferenceExpression { |
| /** |
| * Initialize a newly created prefix expression. |
| */ |
| @@ -6558,15 +6384,6 @@ abstract class PrefixExpression extends Expression { |
| new PrefixExpressionImpl(operator, operand); |
| /** |
| - * Return the best element available for this operator. If resolution was able |
| - * to find a better element based on type propagation, that element will be |
| - * returned. Otherwise, the element found using the result of static analysis |
| - * will be returned. If resolution has not been performed, then `null` will be |
| - * returned. |
| - */ |
| - MethodElement get bestElement; |
| - |
| - /** |
| * Return the expression computing the operand for the operator. |
| */ |
| Expression get operand; |
| @@ -6586,33 +6403,6 @@ abstract class PrefixExpression extends Expression { |
| * Set the prefix operator being applied to the operand to the given [token]. |
| */ |
| void set operator(Token token); |
| - |
| - /** |
| - * Return the element associated with the operator based on the propagated |
| - * type of the operand, or `null` if the AST structure has not been resolved, |
| - * if the operator is not user definable, or if the operator could not be |
| - * resolved. |
| - */ |
| - MethodElement get propagatedElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the propagated type |
| - * of the operand to the given [element]. |
| - */ |
| - void set propagatedElement(MethodElement element); |
| - |
| - /** |
| - * Return the element associated with the operator based on the static type of |
| - * the operand, or `null` if the AST structure has not been resolved, if the |
| - * operator is not user definable, or if the operator could not be resolved. |
| - */ |
| - MethodElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the operator based on the static type of |
| - * the operand to the given [element]. |
| - */ |
| - void set staticElement(MethodElement element); |
| } |
| /** |
| @@ -6695,7 +6485,8 @@ abstract class PropertyAccess extends Expression { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class RedirectingConstructorInvocation extends ConstructorInitializer { |
| +abstract class RedirectingConstructorInvocation extends ConstructorInitializer |
| + implements ConstructorReferenceNode { |
| /** |
| * Initialize a newly created redirecting invocation to invoke the constructor |
| * with the given name with the given arguments. The [constructorName] can be |
| @@ -6741,19 +6532,6 @@ abstract class RedirectingConstructorInvocation extends ConstructorInitializer { |
| void set period(Token token); |
| /** |
| - * Return the element associated with the constructor based on static type |
| - * information, or `null` if the AST structure has not been resolved or if the |
| - * constructor could not be resolved. |
| - */ |
| - ConstructorElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the constructor based on static type |
| - * information to the given [element]. |
| - */ |
| - void set staticElement(ConstructorElement element); |
| - |
| - /** |
| * Return the token for the 'this' keyword. |
| */ |
| Token get thisKeyword; |
| @@ -7193,7 +6971,8 @@ abstract class StringLiteral extends Literal { |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| -abstract class SuperConstructorInvocation extends ConstructorInitializer { |
| +abstract class SuperConstructorInvocation extends ConstructorInitializer |
| + implements ConstructorReferenceNode { |
| /** |
| * Initialize a newly created super invocation to invoke the inherited |
| * constructor with the given name with the given arguments. The [period] and |
| @@ -7240,19 +7019,6 @@ abstract class SuperConstructorInvocation extends ConstructorInitializer { |
| void set period(Token token); |
| /** |
| - * Return the element associated with the constructor based on static type |
| - * information, or `null` if the AST structure has not been resolved or if the |
| - * constructor could not be resolved. |
| - */ |
| - ConstructorElement get staticElement; |
| - |
| - /** |
| - * Set the element associated with the constructor based on static type |
| - * information to the given [element]. |
| - */ |
| - void set staticElement(ConstructorElement element); |
| - |
| - /** |
| * Return the token for the 'super' keyword. |
| */ |
| Token get superKeyword; |