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

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

Issue 1700263002: Add data structures to AST to indicate potentially mutated variables. (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 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 */ 3769 */
3770 bool get isSynchronous; 3770 bool get isSynchronous;
3771 3771
3772 /** 3772 /**
3773 * Return the token representing the 'async' or 'sync' keyword, or `null` if 3773 * Return the token representing the 'async' or 'sync' keyword, or `null` if
3774 * there is no such keyword. 3774 * there is no such keyword.
3775 */ 3775 */
3776 Token get keyword; 3776 Token get keyword;
3777 3777
3778 /** 3778 /**
3779 * Return additional information about local variables and parameters that
3780 * are declared within this function body or any enclosing function body.
3781 * Returns `null` if resolution has not yet been performed.
3782 */
3783 LocalVariableInfo get localVariableInfo;
Brian Wilkerson 2016/02/16 21:13:39 I'm wondering whether it might not be better to av
Paul Berry 2016/02/16 21:49:47 Good idea. Not only does this keep the API smalle
3784
3785 /**
3779 * Return the star following the 'async' or 'sync' keyword, or `null` if there 3786 * Return the star following the 'async' or 'sync' keyword, or `null` if there
3780 * is no star. 3787 * is no star.
3781 */ 3788 */
3782 Token get star; 3789 Token get star;
3783 } 3790 }
3784 3791
3785 /** 3792 /**
3786 * A top-level declaration. 3793 * A top-level declaration.
3787 * 3794 *
3788 * > functionDeclaration ::= 3795 * > functionDeclaration ::=
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 * > | [ListLiteral] 5215 * > | [ListLiteral]
5209 * > | [MapLiteral] 5216 * > | [MapLiteral]
5210 * > | [NullLiteral] 5217 * > | [NullLiteral]
5211 * > | [StringLiteral] 5218 * > | [StringLiteral]
5212 * 5219 *
5213 * Clients may not extend, implement or mix-in this class. 5220 * Clients may not extend, implement or mix-in this class.
5214 */ 5221 */
5215 abstract class Literal extends Expression {} 5222 abstract class Literal extends Expression {}
5216 5223
5217 /** 5224 /**
5225 * Additional information about local variables within a function or method
5226 * produced at resolution time.
5227 *
5228 * Clients may not extend, implement or mix-in this class.
5229 */
5230 abstract class LocalVariableInfo {
5231 /**
5232 * Return the set of local variables and parameters that are potentially
5233 * mutated within a local function other than the function in which they are
5234 * declared.
5235 */
5236 Set<VariableElement> get potentiallyMutatedInClosure;
5237
5238 /**
5239 * Return the set of local variables and parameters that are potentially
5240 * mutated within the scope of their declarations.
5241 */
5242 Set<VariableElement> get potentiallyMutatedInScope;
5243 }
5244
5245 /**
5218 * A literal map. 5246 * A literal map.
5219 * 5247 *
5220 * > mapLiteral ::= 5248 * > mapLiteral ::=
5221 * > 'const'? ('<' [TypeName] (',' [TypeName])* '>')? 5249 * > 'const'? ('<' [TypeName] (',' [TypeName])* '>')?
5222 * > '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}' 5250 * > '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
5223 * 5251 *
5224 * Clients may not extend, implement or mix-in this class. 5252 * Clients may not extend, implement or mix-in this class.
5225 */ 5253 */
5226 abstract class MapLiteral extends TypedLiteral { 5254 abstract class MapLiteral extends TypedLiteral {
5227 /** 5255 /**
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after
8010 /** 8038 /**
8011 * Return the 'yield' keyword. 8039 * Return the 'yield' keyword.
8012 */ 8040 */
8013 Token get yieldKeyword; 8041 Token get yieldKeyword;
8014 8042
8015 /** 8043 /**
8016 * Return the 'yield' keyword to the given [token]. 8044 * Return the 'yield' keyword to the given [token].
8017 */ 8045 */
8018 void set yieldKeyword(Token token); 8046 void set yieldKeyword(Token token);
8019 } 8047 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | pkg/analyzer/lib/src/generated/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698