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

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: Follow Brian's suggestion 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 the star following the 'async' or 'sync' keyword, or `null` if there 3779 * Return the star following the 'async' or 'sync' keyword, or `null` if there
3780 * is no star. 3780 * is no star.
3781 */ 3781 */
3782 Token get star; 3782 Token get star;
3783
3784 /**
3785 * If [variable] is a local variable or parameter declared anywhere within
3786 * the top level function or method containing this [FunctionBody], return a
3787 * boolean indicating whether [variable] is potentially mutated within a
3788 * local function other than the function in which it is declared.
3789 *
3790 * If [variable] is not a local variable or parameter declared within the top
3791 * level function or method containing this [FunctionBody], return `false`.
3792 *
3793 * Throws an exception if resolution has not yet been performed.
3794 */
3795 bool isPotentiallyMutatedInClosure(VariableElement variable);
3796
3797 /**
3798 * If [variable] is a local variable or parameter declared anywhere within
3799 * the top level function or method containing this [FunctionBody], return a
3800 * boolean indicating whether [variable] is potentially mutated within the
3801 * scope of its declaration.
3802 *
3803 * If [variable] is not a local variable or parameter declared within the top
3804 * level function or method containing this [FunctionBody], return `false`.
3805 *
3806 * Throws an exception if resolution has not yet been performed.
3807 */
3808 bool isPotentiallyMutatedInScope(VariableElement variable);
3783 } 3809 }
3784 3810
3785 /** 3811 /**
3786 * A top-level declaration. 3812 * A top-level declaration.
3787 * 3813 *
3788 * > functionDeclaration ::= 3814 * > functionDeclaration ::=
3789 * > 'external' functionSignature 3815 * > 'external' functionSignature
3790 * > | functionSignature [FunctionBody] 3816 * > | functionSignature [FunctionBody]
3791 * > 3817 * >
3792 * > functionSignature ::= 3818 * > functionSignature ::=
(...skipping 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after
8010 /** 8036 /**
8011 * Return the 'yield' keyword. 8037 * Return the 'yield' keyword.
8012 */ 8038 */
8013 Token get yieldKeyword; 8039 Token get yieldKeyword;
8014 8040
8015 /** 8041 /**
8016 * Return the 'yield' keyword to the given [token]. 8042 * Return the 'yield' keyword to the given [token].
8017 */ 8043 */
8018 void set yieldKeyword(Token token); 8044 void set yieldKeyword(Token token);
8019 } 8045 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/ast/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698