Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: pkg/analyzer/lib/dart/ast/ast.dart

Issue 1720433002: fixes #25477, downward inference of generic methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Defines the AST model. The AST (Abstract Syntax Tree) model describes the 6 * Defines the AST model. The AST (Abstract Syntax Tree) model describes the
7 * syntactic (as opposed to semantic) structure of Dart code. The semantic 7 * syntactic (as opposed to semantic) structure of Dart code. The semantic
8 * structure of the code is modeled by the 8 * structure of the code is modeled by the
9 * [element model](../element/element.dart). 9 * [element model](../element/element.dart).
10 * 10 *
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 /** 529 /**
530 * Return the first token included in this node's source range. 530 * Return the first token included in this node's source range.
531 */ 531 */
532 Token get beginToken; 532 Token get beginToken;
533 533
534 /** 534 /**
535 * Return an iterator that can be used to iterate through all the entities 535 * Return an iterator that can be used to iterate through all the entities
536 * (either AST nodes or tokens) that make up the contents of this node, 536 * (either AST nodes or tokens) that make up the contents of this node,
537 * including doc comments but excluding other comments. 537 * including doc comments but excluding other comments.
538 */ 538 */
539 Iterable /*<AstNode | Token>*/ get childEntities; 539 Iterable/*<AstNode | Token>*/ get childEntities;
540 540
541 /** 541 /**
542 * Return the offset of the character immediately following the last character 542 * Return the offset of the character immediately following the last character
543 * of this node's source range. This is equivalent to 543 * of this node's source range. This is equivalent to
544 * `node.getOffset() + node.getLength()`. For a compilation unit this will be 544 * `node.getOffset() + node.getLength()`. For a compilation unit this will be
545 * equal to the length of the unit's source. For synthetic nodes this will be 545 * equal to the length of the unit's source. For synthetic nodes this will be
546 * equivalent to the node's offset (because the length is zero (0) by 546 * equivalent to the node's offset (because the length is zero (0) by
547 * definition). 547 * definition).
548 */ 548 */
549 int get end; 549 int get end;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 * Return the node at the root of this node's AST structure. Note that this 584 * Return the node at the root of this node's AST structure. Note that this
585 * method's performance is linear with respect to the depth of the node in the 585 * method's performance is linear with respect to the depth of the node in the
586 * AST structure (O(depth)). 586 * AST structure (O(depth)).
587 */ 587 */
588 AstNode get root; 588 AstNode get root;
589 589
590 /** 590 /**
591 * Use the given [visitor] to visit this node. Return the value returned by 591 * Use the given [visitor] to visit this node. Return the value returned by
592 * the visitor as a result of visiting this node. 592 * the visitor as a result of visiting this node.
593 */ 593 */
594 dynamic /* =E */ accept /*<E>*/ (AstVisitor /*<E>*/ visitor); 594 dynamic /* =E */ accept/*<E>*/(AstVisitor/*<E>*/ visitor);
595 595
596 /** 596 /**
597 * Return the most immediate ancestor of this node for which the [predicate] 597 * Return the most immediate ancestor of this node for which the [predicate]
598 * returns `true`, or `null` if there is no such ancestor. Note that this node 598 * returns `true`, or `null` if there is no such ancestor. Note that this node
599 * will never be returned. 599 * will never be returned.
600 */ 600 */
601 AstNode getAncestor(Predicate<AstNode> predicate); 601 AstNode getAncestor(Predicate<AstNode> predicate);
602 602
603 /** 603 /**
604 * Return the value of the property with the given [name], or `null` if this 604 * Return the value of the property with the given [name], or `null` if this
(...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 * The invocation of a function resulting from evaluating an expression. 3987 * The invocation of a function resulting from evaluating an expression.
3988 * Invocations of methods and other forms of functions are represented by 3988 * Invocations of methods and other forms of functions are represented by
3989 * [MethodInvocation] nodes. Invocations of getters and setters are represented 3989 * [MethodInvocation] nodes. Invocations of getters and setters are represented
3990 * by either [PrefixedIdentifier] or [PropertyAccess] nodes. 3990 * by either [PrefixedIdentifier] or [PropertyAccess] nodes.
3991 * 3991 *
3992 * > functionExpressionInvocation ::= 3992 * > functionExpressionInvocation ::=
3993 * > [Expression] [TypeArgumentList]? [ArgumentList] 3993 * > [Expression] [TypeArgumentList]? [ArgumentList]
3994 * 3994 *
3995 * Clients may not extend, implement or mix-in this class. 3995 * Clients may not extend, implement or mix-in this class.
3996 */ 3996 */
3997 abstract class FunctionExpressionInvocation extends Expression { 3997 abstract class FunctionExpressionInvocation extends InvocationExpression {
3998 /** 3998 /**
3999 * Initialize a newly created function expression invocation. 3999 * Initialize a newly created function expression invocation.
4000 */ 4000 */
4001 factory FunctionExpressionInvocation( 4001 factory FunctionExpressionInvocation(
4002 Expression function, 4002 Expression function,
4003 TypeArgumentList typeArguments, 4003 TypeArgumentList typeArguments,
4004 ArgumentList argumentList) = FunctionExpressionInvocationImpl; 4004 ArgumentList argumentList) = FunctionExpressionInvocationImpl;
4005 4005
4006 /** 4006 /**
4007 * Return the list of arguments to the method. 4007 * Return the list of arguments to the method.
4008 */ 4008 */
4009 ArgumentList get argumentList; 4009 ArgumentList get argumentList;
Brian Wilkerson 2016/02/22 22:13:25 We should remove the members that are now defined
Jennifer Messerly 2016/02/22 22:45:55 Done.
4010 4010
4011 /** 4011 /**
4012 * Set the list of arguments to the method to the given [argumentList]. 4012 * Set the list of arguments to the method to the given [argumentList].
4013 */ 4013 */
4014 void set argumentList(ArgumentList argumentList); 4014 void set argumentList(ArgumentList argumentList);
4015 4015
4016 /** 4016 /**
4017 * Return the best element available for the function being invoked. If 4017 * Return the best element available for the function being invoked. If
4018 * resolution was able to find a better element based on type propagation, 4018 * resolution was able to find a better element based on type propagation,
4019 * that element will be returned. Otherwise, the element found using the 4019 * that element will be returned. Otherwise, the element found using the
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
4971 */ 4971 */
4972 String get value; 4972 String get value;
4973 4973
4974 /** 4974 /**
4975 * Set the value of the literal to the given [value]. 4975 * Set the value of the literal to the given [value].
4976 */ 4976 */
4977 void set value(String value); 4977 void set value(String value);
4978 } 4978 }
4979 4979
4980 /** 4980 /**
4981 * Common interface for [FunctionExpressionInvocation] and [MethodInvocation].
Brian Wilkerson 2016/02/22 22:13:25 nit: "Common interface for" --> "The invocation of
Jennifer Messerly 2016/02/22 22:45:55 Done.
4982 */
4983 abstract class InvocationExpression extends Expression {
4984 /**
4985 * The function type of the method invocation, or `null` if the AST
Brian Wilkerson 2016/02/22 22:13:25 nit: "The function type of the method invocation"
Jennifer Messerly 2016/02/22 22:45:55 Done. but, FYI, this comment already existed, code
4986 * structure has not been resolved, or if the invoke could not be resolved.
4987 *
4988 * This will usually be a [FunctionType], but it can also be an
4989 * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
4990 * interface type that implements `Function`.
4991 */
4992 DartType staticInvokeType;
Brian Wilkerson 2016/02/22 22:13:25 I have used only getter and setters in the public
4993
4994 /**
4995 * Like [staticInvokeType], but reflects propagated type information.
Brian Wilkerson 2016/02/22 22:13:25 nit: I'd prefer the full documentation here becaus
Jennifer Messerly 2016/02/22 22:45:55 Done. But in general: I very strongly prefer to a
4996 */
4997 DartType propagatedInvokeType;
4998
4999 /**
5000 * Return the list of arguments to the method.
5001 */
5002 ArgumentList get argumentList;
5003
5004 /**
5005 * Set the list of arguments to the method to the given [argumentList].
5006 */
5007 void set argumentList(ArgumentList argumentList);
Brian Wilkerson 2016/02/22 22:13:25 Do we need this setter to be defined here, or are
Jennifer Messerly 2016/02/22 22:45:55 Okay, moved setters back down.
5008
5009 /**
5010 * The target of the invocation node. For example:
5011 *
5012 * (o.m)<TArgs>(args); // target will be `o.m`
5013 * o.m<TArgs>(args); // target will be `m`
5014 *
5015 * In either case, the [invocationTarget.staticType] will be the
5016 * [staticInvokeType] before applying type arguments `TArgs`. Similarly,
5017 * [invocationTarget.propagatedType] will be the [propagatedInvokeType]
5018 * before applying type arguments `TArgs`.
5019 */
5020 Expression get invocationTarget;
Brian Wilkerson 2016/02/22 22:13:25 I was a bit confused when I first read the comment
Jennifer Messerly 2016/02/22 22:45:55 Nice, yeah "function" is a good idea. Done. (& upd
5021
5022 /**
5023 * Return the type arguments to be applied to the method being invoked, or
5024 * `null` if no type arguments were provided.
5025 */
5026 TypeArgumentList get typeArguments;
5027
5028 /**
5029 * Set the type arguments to be applied to the method being invoked to the
5030 * given [typeArguments].
5031 */
5032 void set typeArguments(TypeArgumentList typeArguments);
Brian Wilkerson 2016/02/22 22:13:25 Do we need this?
Jennifer Messerly 2016/02/22 22:45:55 Done, moved down to subclasses.
5033 }
5034
5035 /**
4981 * An is expression. 5036 * An is expression.
4982 * 5037 *
4983 * > isExpression ::= 5038 * > isExpression ::=
4984 * > [Expression] 'is' '!'? [TypeName] 5039 * > [Expression] 'is' '!'? [TypeName]
4985 * 5040 *
4986 * Clients may not extend, implement or mix-in this class. 5041 * Clients may not extend, implement or mix-in this class.
4987 */ 5042 */
4988 abstract class IsExpression extends Expression { 5043 abstract class IsExpression extends Expression {
4989 /** 5044 /**
4990 * Initialize a newly created is expression. The [notOperator] can be `null` 5045 * Initialize a newly created is expression. The [notOperator] can be `null`
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
5512 * The invocation of either a function or a method. Invocations of functions 5567 * The invocation of either a function or a method. Invocations of functions
5513 * resulting from evaluating an expression are represented by 5568 * resulting from evaluating an expression are represented by
5514 * [FunctionExpressionInvocation] nodes. Invocations of getters and setters are 5569 * [FunctionExpressionInvocation] nodes. Invocations of getters and setters are
5515 * represented by either [PrefixedIdentifier] or [PropertyAccess] nodes. 5570 * represented by either [PrefixedIdentifier] or [PropertyAccess] nodes.
5516 * 5571 *
5517 * > methodInvocation ::= 5572 * > methodInvocation ::=
5518 * > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentLis t] 5573 * > ([Expression] '.')? [SimpleIdentifier] [TypeArgumentList]? [ArgumentLis t]
5519 * 5574 *
5520 * Clients may not extend, implement or mix-in this class. 5575 * Clients may not extend, implement or mix-in this class.
5521 */ 5576 */
5522 abstract class MethodInvocation extends Expression { 5577 abstract class MethodInvocation extends InvocationExpression {
5523 /** 5578 /**
5524 * Initialize a newly created method invocation. The [target] and [operator] 5579 * Initialize a newly created method invocation. The [target] and [operator]
5525 * can be `null` if there is no target. 5580 * can be `null` if there is no target.
5526 */ 5581 */
5527 factory MethodInvocation( 5582 factory MethodInvocation(
5528 Expression target, 5583 Expression target,
5529 Token operator, 5584 Token operator,
5530 SimpleIdentifier methodName, 5585 SimpleIdentifier methodName,
5531 TypeArgumentList typeArguments, 5586 TypeArgumentList typeArguments,
5532 ArgumentList argumentList) = MethodInvocationImpl; 5587 ArgumentList argumentList) = MethodInvocationImpl;
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
8036 /** 8091 /**
8037 * Return the 'yield' keyword. 8092 * Return the 'yield' keyword.
8038 */ 8093 */
8039 Token get yieldKeyword; 8094 Token get yieldKeyword;
8040 8095
8041 /** 8096 /**
8042 * Return the 'yield' keyword to the given [token]. 8097 * Return the 'yield' keyword to the given [token].
8043 */ 8098 */
8044 void set yieldKeyword(Token token); 8099 void set yieldKeyword(Token token);
8045 } 8100 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | pkg/analyzer/lib/src/dart/ast/ast.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698