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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/ast.dart

Issue 27278004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.ast; 3 library engine.ast;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'error.dart';
8 import 'source.dart' show LineInfo;
9 import 'scanner.dart'; 7 import 'scanner.dart';
10 import 'engine.dart' show AnalysisEngine; 8 import 'engine.dart' show AnalysisEngine;
11 import 'utilities_dart.dart'; 9 import 'utilities_dart.dart';
12 import 'element.dart'; 10 import 'element.dart';
13 /** 11 /**
14 * The abstract class `ASTNode` defines the behavior common to all nodes in the AST structure 12 * The abstract class `ASTNode` defines the behavior common to all nodes in the AST structure
15 * for a Dart program. 13 * for a Dart program.
16 * 14 *
17 * @coverage dart.engine.ast 15 * @coverage dart.engine.ast
18 */ 16 */
(...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 */ 2771 */
2774 Token _endToken; 2772 Token _endToken;
2775 2773
2776 /** 2774 /**
2777 * The element associated with this compilation unit, or `null` if the AST str ucture has not 2775 * The element associated with this compilation unit, or `null` if the AST str ucture has not
2778 * been resolved. 2776 * been resolved.
2779 */ 2777 */
2780 CompilationUnitElement element; 2778 CompilationUnitElement element;
2781 2779
2782 /** 2780 /**
2783 * The line information for this compilation unit.
2784 */
2785 LineInfo lineInfo;
2786
2787 /**
2788 * The parsing errors encountered when the receiver was parsed.
2789 */
2790 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS;
2791
2792 /**
2793 * The resolution errors encountered when the receiver was resolved.
2794 */
2795 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS;
2796
2797 /**
2798 * The hints reported when the receiver was analyzed.
2799 */
2800 List<AnalysisError> _hints = AnalysisError.NO_ERRORS;
2801
2802 /**
2803 * Initialize a newly created compilation unit to have the given directives an d declarations. 2781 * Initialize a newly created compilation unit to have the given directives an d declarations.
2804 * 2782 *
2805 * @param beginToken the first token in the token stream 2783 * @param beginToken the first token in the token stream
2806 * @param scriptTag the script tag at the beginning of the compilation unit 2784 * @param scriptTag the script tag at the beginning of the compilation unit
2807 * @param directives the directives contained in this compilation unit 2785 * @param directives the directives contained in this compilation unit
2808 * @param declarations the declarations contained in this compilation unit 2786 * @param declarations the declarations contained in this compilation unit
2809 * @param endToken the last token in the token stream 2787 * @param endToken the last token in the token stream
2810 */ 2788 */
2811 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di rectives, List<CompilationUnitMember> declarations, Token endToken) { 2789 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di rectives, List<CompilationUnitMember> declarations, Token endToken) {
2812 this.directives = new NodeList<Directive>(this); 2790 this.directives = new NodeList<Directive>(this);
(...skipping 11 matching lines...) Expand all
2824 * @param beginToken the first token in the token stream 2802 * @param beginToken the first token in the token stream
2825 * @param scriptTag the script tag at the beginning of the compilation unit 2803 * @param scriptTag the script tag at the beginning of the compilation unit
2826 * @param directives the directives contained in this compilation unit 2804 * @param directives the directives contained in this compilation unit
2827 * @param declarations the declarations contained in this compilation unit 2805 * @param declarations the declarations contained in this compilation unit
2828 * @param endToken the last token in the token stream 2806 * @param endToken the last token in the token stream
2829 */ 2807 */
2830 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg inToken, scriptTag, directives, declarations, endToken); 2808 CompilationUnit({Token beginToken, ScriptTag scriptTag, List<Directive> direct ives, List<CompilationUnitMember> declarations, Token endToken}) : this.full(beg inToken, scriptTag, directives, declarations, endToken);
2831 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this); 2809 accept(ASTVisitor visitor) => visitor.visitCompilationUnit(this);
2832 Token get beginToken => _beginToken; 2810 Token get beginToken => _beginToken;
2833 Token get endToken => _endToken; 2811 Token get endToken => _endToken;
2834
2835 /**
2836 * Return an array containing all of the errors associated with the receiver. The array will be
2837 * empty if the receiver has not been resolved and there were no parse errors.
2838 *
2839 * @return the errors associated with the receiver
2840 */
2841 List<AnalysisError> get errors {
2842 List<AnalysisError> parserErrors = parsingErrors;
2843 List<AnalysisError> resolverErrors = resolutionErrors;
2844 List<AnalysisError> hints = this.hints;
2845 if (resolverErrors.length == 0 && hints.length == 0) {
2846 return parserErrors;
2847 } else if (parserErrors.length == 0 && hints.length == 0) {
2848 return resolverErrors;
2849 } else if (parserErrors.length == 0 && resolverErrors.length == 0) {
2850 return hints;
2851 } else {
2852 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length + hints.length);
2853 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length);
2854 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re solverErrors.length);
2855 JavaSystem.arraycopy(hints, 0, allErrors, parserErrors.length + resolverEr rors.length, hints.length);
2856 return allErrors;
2857 }
2858 }
2859
2860 /**
2861 * Return an array containing all of the hints associated with the receiver. T he array will be
2862 * empty if the receiver has not been analyzed.
2863 *
2864 * @return the hints associated with the receiver
2865 */
2866 List<AnalysisError> get hints => _hints;
2867 int get length { 2812 int get length {
2868 Token endToken = this.endToken; 2813 Token endToken = this.endToken;
2869 if (endToken == null) { 2814 if (endToken == null) {
2870 return 0; 2815 return 0;
2871 } 2816 }
2872 return endToken.offset + endToken.length; 2817 return endToken.offset + endToken.length;
2873 } 2818 }
2874 int get offset => 0; 2819 int get offset => 0;
2875 2820
2876 /** 2821 /**
2877 * Return an array containing all of the parsing errors associated with the re ceiver.
2878 *
2879 * @return the parsing errors associated with the receiver
2880 */
2881 List<AnalysisError> get parsingErrors => _parsingErrors;
2882
2883 /**
2884 * Return an array containing all of the resolution errors associated with the receiver. The array
2885 * will be empty if the receiver has not been resolved.
2886 *
2887 * @return the resolution errors associated with the receiver
2888 */
2889 List<AnalysisError> get resolutionErrors => _resolutionErrors;
2890
2891 /**
2892 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no 2822 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no
2893 * script tag in this compilation unit. 2823 * script tag in this compilation unit.
2894 * 2824 *
2895 * @return the script tag at the beginning of the compilation unit 2825 * @return the script tag at the beginning of the compilation unit
2896 */ 2826 */
2897 ScriptTag get scriptTag => _scriptTag; 2827 ScriptTag get scriptTag => _scriptTag;
2898 2828
2899 /** 2829 /**
2900 * Set the reported hints associated with this compilation unit.
2901 *
2902 * @param the hints to be associated with this compilation unit
2903 */
2904 void set hints(List<AnalysisError> errors) {
2905 _hints = errors == null ? AnalysisError.NO_ERRORS : errors;
2906 }
2907
2908 /**
2909 * Set the parse errors associated with this compilation unit to the given err ors.
2910 *
2911 * @param the parse errors to be associated with this compilation unit
2912 */
2913 void set parsingErrors(List<AnalysisError> errors) {
2914 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
2915 }
2916
2917 /**
2918 * Set the resolution errors associated with this compilation unit to the give n errors.
2919 *
2920 * @param the resolution errors to be associated with this compilation unit
2921 */
2922 void set resolutionErrors(List<AnalysisError> errors) {
2923 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
2924 }
2925
2926 /**
2927 * Set the script tag at the beginning of the compilation unit to the given sc ript tag. 2830 * Set the script tag at the beginning of the compilation unit to the given sc ript tag.
2928 * 2831 *
2929 * @param scriptTag the script tag at the beginning of the compilation unit 2832 * @param scriptTag the script tag at the beginning of the compilation unit
2930 */ 2833 */
2931 void set scriptTag(ScriptTag scriptTag) { 2834 void set scriptTag(ScriptTag scriptTag) {
2932 this._scriptTag = becomeParentOf(scriptTag); 2835 this._scriptTag = becomeParentOf(scriptTag);
2933 } 2836 }
2934 void visitChildren(ASTVisitor visitor) { 2837 void visitChildren(ASTVisitor visitor) {
2935 safelyVisitChild(_scriptTag, visitor); 2838 safelyVisitChild(_scriptTag, visitor);
2936 if (directivesAreBeforeDeclarations()) { 2839 if (directivesAreBeforeDeclarations()) {
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 * </pre> 3924 * </pre>
4022 * 3925 *
4023 * @coverage dart.engine.ast 3926 * @coverage dart.engine.ast
4024 */ 3927 */
4025 abstract class Directive extends AnnotatedNode { 3928 abstract class Directive extends AnnotatedNode {
4026 3929
4027 /** 3930 /**
4028 * The element associated with this directive, or `null` if the AST structure has not been 3931 * The element associated with this directive, or `null` if the AST structure has not been
4029 * resolved or if this directive could not be resolved. 3932 * resolved or if this directive could not be resolved.
4030 */ 3933 */
4031 Element element; 3934 Element _element;
4032 3935
4033 /** 3936 /**
4034 * Initialize a newly create directive. 3937 * Initialize a newly create directive.
4035 * 3938 *
4036 * @param comment the documentation comment associated with this directive 3939 * @param comment the documentation comment associated with this directive
4037 * @param metadata the annotations associated with the directive 3940 * @param metadata the annotations associated with the directive
4038 */ 3941 */
4039 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen t, metadata); 3942 Directive.full(Comment comment, List<Annotation> metadata) : super.full(commen t, metadata);
4040 3943
4041 /** 3944 /**
4042 * Initialize a newly create directive. 3945 * Initialize a newly create directive.
4043 * 3946 *
4044 * @param comment the documentation comment associated with this directive 3947 * @param comment the documentation comment associated with this directive
4045 * @param metadata the annotations associated with the directive 3948 * @param metadata the annotations associated with the directive
4046 */ 3949 */
4047 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m etadata); 3950 Directive({Comment comment, List<Annotation> metadata}) : this.full(comment, m etadata);
4048 3951
4049 /** 3952 /**
3953 * Return the element associated with this directive, or `null` if the AST str ucture has not
3954 * been resolved or if this directive could not be resolved. Examples of the l atter case include a
3955 * directive that contains an invalid URL or a URL that does not exist.
3956 *
3957 * @return the element associated with this directive
3958 */
3959 Element get element => _element;
3960
3961 /**
4050 * Return the token representing the keyword that introduces this directive (' import', 'export', 3962 * Return the token representing the keyword that introduces this directive (' import', 'export',
4051 * 'library' or 'part'). 3963 * 'library' or 'part').
4052 * 3964 *
4053 * @return the token representing the keyword that introduces this directive 3965 * @return the token representing the keyword that introduces this directive
4054 */ 3966 */
4055 Token get keyword; 3967 Token get keyword;
3968
3969 /**
3970 * Set the element associated with this directive to the given element.
3971 *
3972 * @param element the element associated with this directive
3973 */
3974 void set element(Element element) {
3975 this._element = element;
3976 }
4056 } 3977 }
4057 /** 3978 /**
4058 * Instances of the class `DoStatement` represent a do statement. 3979 * Instances of the class `DoStatement` represent a do statement.
4059 * 3980 *
4060 * <pre> 3981 * <pre>
4061 * doStatement ::= 3982 * doStatement ::=
4062 * 'do' [Statement] 'while' '(' [Expression] ')' ';' 3983 * 'do' [Statement] 'while' '(' [Expression] ')' ';'
4063 * </pre> 3984 * </pre>
4064 * 3985 *
4065 * @coverage dart.engine.ast 3986 * @coverage dart.engine.ast
(...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after
6708 * @param metadata the annotations associated with the directive 6629 * @param metadata the annotations associated with the directive
6709 * @param keyword the token representing the 'import' keyword 6630 * @param keyword the token representing the 'import' keyword
6710 * @param libraryUri the URI of the library being imported 6631 * @param libraryUri the URI of the library being imported
6711 * @param asToken the token representing the 'as' token 6632 * @param asToken the token representing the 'as' token
6712 * @param prefix the prefix to be used with the imported names 6633 * @param prefix the prefix to be used with the imported names
6713 * @param combinators the combinators used to control how names are imported 6634 * @param combinators the combinators used to control how names are imported
6714 * @param semicolon the semicolon terminating the directive 6635 * @param semicolon the semicolon terminating the directive
6715 */ 6636 */
6716 ImportDirective({Comment comment, List<Annotation> metadata, Token keyword, St ringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator> combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryU ri, asToken, prefix, combinators, semicolon); 6637 ImportDirective({Comment comment, List<Annotation> metadata, Token keyword, St ringLiteral libraryUri, Token asToken, SimpleIdentifier prefix, List<Combinator> combinators, Token semicolon}) : this.full(comment, metadata, keyword, libraryU ri, asToken, prefix, combinators, semicolon);
6717 accept(ASTVisitor visitor) => visitor.visitImportDirective(this); 6638 accept(ASTVisitor visitor) => visitor.visitImportDirective(this);
6639 ImportElement get element => super.element as ImportElement;
6718 6640
6719 /** 6641 /**
6720 * Return the prefix to be used with the imported names, or `null` if the impo rted names are 6642 * Return the prefix to be used with the imported names, or `null` if the impo rted names are
6721 * not prefixed. 6643 * not prefixed.
6722 * 6644 *
6723 * @return the prefix to be used with the imported names 6645 * @return the prefix to be used with the imported names
6724 */ 6646 */
6725 SimpleIdentifier get prefix => _prefix; 6647 SimpleIdentifier get prefix => _prefix;
6726 LibraryElement get uriElement { 6648 LibraryElement get uriElement {
6727 Element element = this.element; 6649 ImportElement element = this.element;
6728 if (element is ImportElement) { 6650 if (element == null) {
6729 return ((element as ImportElement)).importedLibrary; 6651 return null;
6730 } 6652 }
6731 return null; 6653 return element.importedLibrary;
6732 } 6654 }
6733 6655
6734 /** 6656 /**
6735 * Set the prefix to be used with the imported names to the given identifier. 6657 * Set the prefix to be used with the imported names to the given identifier.
6736 * 6658 *
6737 * @param prefix the prefix to be used with the imported names 6659 * @param prefix the prefix to be used with the imported names
6738 */ 6660 */
6739 void set prefix(SimpleIdentifier prefix) { 6661 void set prefix(SimpleIdentifier prefix) {
6740 this._prefix = becomeParentOf(prefix); 6662 this._prefix = becomeParentOf(prefix);
6741 } 6663 }
(...skipping 6185 matching lines...) Expand 10 before | Expand all | Expand 10 after
12927 R visitWithClause(WithClause node) => visitNode(node); 12849 R visitWithClause(WithClause node) => visitNode(node);
12928 } 12850 }
12929 /** 12851 /**
12930 * Instances of the class `NodeLocator` locate the [ASTNode] associated with a 12852 * Instances of the class `NodeLocator` locate the [ASTNode] associated with a
12931 * source range, given the AST structure built from the source. More specificall y, they will return 12853 * source range, given the AST structure built from the source. More specificall y, they will return
12932 * the [ASTNode] with the shortest length whose source range completely encompas ses 12854 * the [ASTNode] with the shortest length whose source range completely encompas ses
12933 * the specified range. 12855 * the specified range.
12934 * 12856 *
12935 * @coverage dart.engine.ast 12857 * @coverage dart.engine.ast
12936 */ 12858 */
12937 class NodeLocator extends GeneralizingASTVisitor<Object> { 12859 class NodeLocator extends UnifyingASTVisitor<Object> {
12938 12860
12939 /** 12861 /**
12940 * The start offset of the range used to identify the node. 12862 * The start offset of the range used to identify the node.
12941 */ 12863 */
12942 int _startOffset = 0; 12864 int _startOffset = 0;
12943 12865
12944 /** 12866 /**
12945 * The end offset of the range used to identify the node. 12867 * The end offset of the range used to identify the node.
12946 */ 12868 */
12947 int _endOffset = 0; 12869 int _endOffset = 0;
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
13681 visit(node.typeParameters); 13603 visit(node.typeParameters);
13682 visit3(" ", node.extendsClause); 13604 visit3(" ", node.extendsClause);
13683 visit3(" ", node.withClause); 13605 visit3(" ", node.withClause);
13684 visit3(" ", node.implementsClause); 13606 visit3(" ", node.implementsClause);
13685 _writer.print(" {"); 13607 _writer.print(" {");
13686 visitList2(node.members, " "); 13608 visitList2(node.members, " ");
13687 _writer.print("}"); 13609 _writer.print("}");
13688 return null; 13610 return null;
13689 } 13611 }
13690 Object visitClassTypeAlias(ClassTypeAlias node) { 13612 Object visitClassTypeAlias(ClassTypeAlias node) {
13691 _writer.print("typedef "); 13613 _writer.print("class ");
13692 visit(node.name); 13614 visit(node.name);
13693 visit(node.typeParameters); 13615 visit(node.typeParameters);
13694 _writer.print(" = "); 13616 _writer.print(" = ");
13695 if (node.abstractKeyword != null) { 13617 if (node.abstractKeyword != null) {
13696 _writer.print("abstract "); 13618 _writer.print("abstract ");
13697 } 13619 }
13698 visit(node.superclass); 13620 visit(node.superclass);
13699 visit3(" ", node.withClause); 13621 visit3(" ", node.withClause);
13700 visit3(" ", node.implementsClause); 13622 visit3(" ", node.implementsClause);
13701 _writer.print(";"); 13623 _writer.print(";");
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
14418 if (i > 0) { 14340 if (i > 0) {
14419 _writer.print(separator); 14341 _writer.print(separator);
14420 } 14342 }
14421 nodes[i].accept(this); 14343 nodes[i].accept(this);
14422 } 14344 }
14423 } 14345 }
14424 } 14346 }
14425 } 14347 }
14426 } 14348 }
14427 /** 14349 /**
14350 * Instances of the class `UnifyingASTVisitor` implement an AST visitor that wil l recursively
14351 * visit all of the nodes in an AST structure (like instances of the class
14352 * [RecursiveASTVisitor]). In addition, every node will also be visited by using a single
14353 * unified [visitNode] method.
14354 *
14355 * Subclasses that override a visit method must either invoke the overridden vis it method or
14356 * explicitly invoke the more general [visitNode] method. Failure to do so will
14357 * cause the children of the visited node to not be visited.
14358 *
14359 * @coverage dart.engine.ast
14360 */
14361 class UnifyingASTVisitor<R> implements ASTVisitor<R> {
14362 R visitAdjacentStrings(AdjacentStrings node) => visitNode(node);
14363 R visitAnnotation(Annotation node) => visitNode(node);
14364 R visitArgumentDefinitionTest(ArgumentDefinitionTest node) => visitNode(node);
14365 R visitArgumentList(ArgumentList node) => visitNode(node);
14366 R visitAsExpression(AsExpression node) => visitNode(node);
14367 R visitAssertStatement(AssertStatement node) => visitNode(node);
14368 R visitAssignmentExpression(AssignmentExpression node) => visitNode(node);
14369 R visitBinaryExpression(BinaryExpression node) => visitNode(node);
14370 R visitBlock(Block node) => visitNode(node);
14371 R visitBlockFunctionBody(BlockFunctionBody node) => visitNode(node);
14372 R visitBooleanLiteral(BooleanLiteral node) => visitNode(node);
14373 R visitBreakStatement(BreakStatement node) => visitNode(node);
14374 R visitCascadeExpression(CascadeExpression node) => visitNode(node);
14375 R visitCatchClause(CatchClause node) => visitNode(node);
14376 R visitClassDeclaration(ClassDeclaration node) => visitNode(node);
14377 R visitClassTypeAlias(ClassTypeAlias node) => visitNode(node);
14378 R visitComment(Comment node) => visitNode(node);
14379 R visitCommentReference(CommentReference node) => visitNode(node);
14380 R visitCompilationUnit(CompilationUnit node) => visitNode(node);
14381 R visitConditionalExpression(ConditionalExpression node) => visitNode(node);
14382 R visitConstructorDeclaration(ConstructorDeclaration node) => visitNode(node);
14383 R visitConstructorFieldInitializer(ConstructorFieldInitializer node) => visitN ode(node);
14384 R visitConstructorName(ConstructorName node) => visitNode(node);
14385 R visitContinueStatement(ContinueStatement node) => visitNode(node);
14386 R visitDeclaredIdentifier(DeclaredIdentifier node) => visitNode(node);
14387 R visitDefaultFormalParameter(DefaultFormalParameter node) => visitNode(node);
14388 R visitDoStatement(DoStatement node) => visitNode(node);
14389 R visitDoubleLiteral(DoubleLiteral node) => visitNode(node);
14390 R visitEmptyFunctionBody(EmptyFunctionBody node) => visitNode(node);
14391 R visitEmptyStatement(EmptyStatement node) => visitNode(node);
14392 R visitExportDirective(ExportDirective node) => visitNode(node);
14393 R visitExpressionFunctionBody(ExpressionFunctionBody node) => visitNode(node);
14394 R visitExpressionStatement(ExpressionStatement node) => visitNode(node);
14395 R visitExtendsClause(ExtendsClause node) => visitNode(node);
14396 R visitFieldDeclaration(FieldDeclaration node) => visitNode(node);
14397 R visitFieldFormalParameter(FieldFormalParameter node) => visitNode(node);
14398 R visitForEachStatement(ForEachStatement node) => visitNode(node);
14399 R visitFormalParameterList(FormalParameterList node) => visitNode(node);
14400 R visitForStatement(ForStatement node) => visitNode(node);
14401 R visitFunctionDeclaration(FunctionDeclaration node) => visitNode(node);
14402 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => visi tNode(node);
14403 R visitFunctionExpression(FunctionExpression node) => visitNode(node);
14404 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => visi tNode(node);
14405 R visitFunctionTypeAlias(FunctionTypeAlias node) => visitNode(node);
14406 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => visi tNode(node);
14407 R visitHideCombinator(HideCombinator node) => visitNode(node);
14408 R visitIfStatement(IfStatement node) => visitNode(node);
14409 R visitImplementsClause(ImplementsClause node) => visitNode(node);
14410 R visitImportDirective(ImportDirective node) => visitNode(node);
14411 R visitIndexExpression(IndexExpression node) => visitNode(node);
14412 R visitInstanceCreationExpression(InstanceCreationExpression node) => visitNod e(node);
14413 R visitIntegerLiteral(IntegerLiteral node) => visitNode(node);
14414 R visitInterpolationExpression(InterpolationExpression node) => visitNode(node );
14415 R visitInterpolationString(InterpolationString node) => visitNode(node);
14416 R visitIsExpression(IsExpression node) => visitNode(node);
14417 R visitLabel(Label node) => visitNode(node);
14418 R visitLabeledStatement(LabeledStatement node) => visitNode(node);
14419 R visitLibraryDirective(LibraryDirective node) => visitNode(node);
14420 R visitLibraryIdentifier(LibraryIdentifier node) => visitNode(node);
14421 R visitListLiteral(ListLiteral node) => visitNode(node);
14422 R visitMapLiteral(MapLiteral node) => visitNode(node);
14423 R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node);
14424 R visitMethodDeclaration(MethodDeclaration node) => visitNode(node);
14425 R visitMethodInvocation(MethodInvocation node) => visitNode(node);
14426 R visitNamedExpression(NamedExpression node) => visitNode(node);
14427 R visitNativeClause(NativeClause node) => visitNode(node);
14428 R visitNativeFunctionBody(NativeFunctionBody node) => visitNode(node);
14429 R visitNode(ASTNode node) {
14430 node.visitChildren(this);
14431 return null;
14432 }
14433 R visitNullLiteral(NullLiteral node) => visitNode(node);
14434 R visitParenthesizedExpression(ParenthesizedExpression node) => visitNode(node );
14435 R visitPartDirective(PartDirective node) => visitNode(node);
14436 R visitPartOfDirective(PartOfDirective node) => visitNode(node);
14437 R visitPostfixExpression(PostfixExpression node) => visitNode(node);
14438 R visitPrefixedIdentifier(PrefixedIdentifier node) => visitNode(node);
14439 R visitPrefixExpression(PrefixExpression node) => visitNode(node);
14440 R visitPropertyAccess(PropertyAccess node) => visitNode(node);
14441 R visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) => visitNode(node);
14442 R visitRethrowExpression(RethrowExpression node) => visitNode(node);
14443 R visitReturnStatement(ReturnStatement node) => visitNode(node);
14444 R visitScriptTag(ScriptTag scriptTag) => visitNode(scriptTag);
14445 R visitShowCombinator(ShowCombinator node) => visitNode(node);
14446 R visitSimpleFormalParameter(SimpleFormalParameter node) => visitNode(node);
14447 R visitSimpleIdentifier(SimpleIdentifier node) => visitNode(node);
14448 R visitSimpleStringLiteral(SimpleStringLiteral node) => visitNode(node);
14449 R visitStringInterpolation(StringInterpolation node) => visitNode(node);
14450 R visitSuperConstructorInvocation(SuperConstructorInvocation node) => visitNod e(node);
14451 R visitSuperExpression(SuperExpression node) => visitNode(node);
14452 R visitSwitchCase(SwitchCase node) => visitNode(node);
14453 R visitSwitchDefault(SwitchDefault node) => visitNode(node);
14454 R visitSwitchStatement(SwitchStatement node) => visitNode(node);
14455 R visitSymbolLiteral(SymbolLiteral node) => visitNode(node);
14456 R visitThisExpression(ThisExpression node) => visitNode(node);
14457 R visitThrowExpression(ThrowExpression node) => visitNode(node);
14458 R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => visitN ode(node);
14459 R visitTryStatement(TryStatement node) => visitNode(node);
14460 R visitTypeArgumentList(TypeArgumentList node) => visitNode(node);
14461 R visitTypeName(TypeName node) => visitNode(node);
14462 R visitTypeParameter(TypeParameter node) => visitNode(node);
14463 R visitTypeParameterList(TypeParameterList node) => visitNode(node);
14464 R visitVariableDeclaration(VariableDeclaration node) => visitNode(node);
14465 R visitVariableDeclarationList(VariableDeclarationList node) => visitNode(node );
14466 R visitVariableDeclarationStatement(VariableDeclarationStatement node) => visi tNode(node);
14467 R visitWhileStatement(WhileStatement node) => visitNode(node);
14468 R visitWithClause(WithClause node) => visitNode(node);
14469 }
14470 /**
14428 * Instances of the class `ASTCloner` implement an object that will clone any AS T structure 14471 * Instances of the class `ASTCloner` implement an object that will clone any AS T structure
14429 * that it visits. The cloner will only clone the structure, it will not preserv e any resolution 14472 * that it visits. The cloner will only clone the structure, it will not preserv e any resolution
14430 * results or properties associated with the nodes. 14473 * results or properties associated with the nodes.
14431 */ 14474 */
14432 class ASTCloner implements ASTVisitor<ASTNode> { 14475 class ASTCloner implements ASTVisitor<ASTNode> {
14433 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs.full(clone3(node.strings)); 14476 AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStri ngs.full(clone3(node.strings));
14434 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign , clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu ments)); 14477 Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign , clone2(node.name), node.period, clone2(node.constructorName), clone2(node.argu ments));
14435 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier)); 14478 ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node ) => new ArgumentDefinitionTest.full(node.question, clone2(node.identifier));
14436 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod e.leftParenthesis, clone3(node.arguments), node.rightParenthesis); 14479 ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(nod e.leftParenthesis, clone3(node.arguments), node.rightParenthesis);
14437 AsExpression visitAsExpression(AsExpression node) => new AsExpression.full(clo ne2(node.expression), node.asOperator, clone2(node.type)); 14480 AsExpression visitAsExpression(AsExpression node) => new AsExpression.full(clo ne2(node.expression), node.asOperator, clone2(node.type));
(...skipping 16 matching lines...) Expand all
14454 if (node.isDocumentation) { 14497 if (node.isDocumentation) {
14455 return Comment.createDocumentationComment2(node.tokens, clone3(node.refere nces)); 14498 return Comment.createDocumentationComment2(node.tokens, clone3(node.refere nces));
14456 } else if (node.isBlock) { 14499 } else if (node.isBlock) {
14457 return Comment.createBlockComment(node.tokens); 14500 return Comment.createBlockComment(node.tokens);
14458 } 14501 }
14459 return Comment.createEndOfLineComment(node.tokens); 14502 return Comment.createEndOfLineComment(node.tokens);
14460 } 14503 }
14461 CommentReference visitCommentReference(CommentReference node) => new CommentRe ference.full(node.newKeyword, clone2(node.identifier)); 14504 CommentReference visitCommentReference(CommentReference node) => new CommentRe ference.full(node.newKeyword, clone2(node.identifier));
14462 CompilationUnit visitCompilationUnit(CompilationUnit node) { 14505 CompilationUnit visitCompilationUnit(CompilationUnit node) {
14463 CompilationUnit clone = new CompilationUnit.full(node.beginToken, clone2(nod e.scriptTag), clone3(node.directives), clone3(node.declarations), node.endToken) ; 14506 CompilationUnit clone = new CompilationUnit.full(node.beginToken, clone2(nod e.scriptTag), clone3(node.directives), clone3(node.declarations), node.endToken) ;
14464 clone.lineInfo = node.lineInfo;
14465 clone.parsingErrors = node.parsingErrors;
14466 clone.resolutionErrors = node.resolutionErrors;
14467 clone.hints = node.hints;
14468 return clone; 14507 return clone;
14469 } 14508 }
14470 ConditionalExpression visitConditionalExpression(ConditionalExpression node) = > new ConditionalExpression.full(clone2(node.condition), node.question, clone2(n ode.thenExpression), node.colon, clone2(node.elseExpression)); 14509 ConditionalExpression visitConditionalExpression(ConditionalExpression node) = > new ConditionalExpression.full(clone2(node.condition), node.question, clone2(n ode.thenExpression), node.colon, clone2(node.elseExpression));
14471 ConstructorDeclaration visitConstructorDeclaration(ConstructorDeclaration node ) => new ConstructorDeclaration.full(clone2(node.documentationComment), clone3(n ode.metadata), node.externalKeyword, node.constKeyword, node.factoryKeyword, clo ne2(node.returnType), node.period, clone2(node.name), clone2(node.parameters), n ode.separator, clone3(node.initializers), clone2(node.redirectedConstructor), cl one2(node.body)); 14510 ConstructorDeclaration visitConstructorDeclaration(ConstructorDeclaration node ) => new ConstructorDeclaration.full(clone2(node.documentationComment), clone3(n ode.metadata), node.externalKeyword, node.constKeyword, node.factoryKeyword, clo ne2(node.returnType), node.period, clone2(node.name), clone2(node.parameters), n ode.separator, clone3(node.initializers), clone2(node.redirectedConstructor), cl one2(node.body));
14472 ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldI nitializer node) => new ConstructorFieldInitializer.full(node.keyword, node.peri od, clone2(node.fieldName), node.equals, clone2(node.expression)); 14511 ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldI nitializer node) => new ConstructorFieldInitializer.full(node.keyword, node.peri od, clone2(node.fieldName), node.equals, clone2(node.expression));
14473 ConstructorName visitConstructorName(ConstructorName node) => new ConstructorN ame.full(clone2(node.type), node.period, clone2(node.name)); 14512 ConstructorName visitConstructorName(ConstructorName node) => new ConstructorN ame.full(clone2(node.type), node.period, clone2(node.name));
14474 ContinueStatement visitContinueStatement(ContinueStatement node) => new Contin ueStatement.full(node.keyword, clone2(node.label), node.semicolon); 14513 ContinueStatement visitContinueStatement(ContinueStatement node) => new Contin ueStatement.full(node.keyword, clone2(node.label), node.semicolon);
14475 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new Dec laredIdentifier.full(clone2(node.documentationComment), clone3(node.metadata), n ode.keyword, clone2(node.type), clone2(node.identifier)); 14514 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new Dec laredIdentifier.full(clone2(node.documentationComment), clone3(node.metadata), n ode.keyword, clone2(node.type), clone2(node.identifier));
14476 DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node ) => new DefaultFormalParameter.full(clone2(node.parameter), node.kind, node.sep arator, clone2(node.defaultValue)); 14515 DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node ) => new DefaultFormalParameter.full(clone2(node.parameter), node.kind, node.sep arator, clone2(node.defaultValue));
14477 DoStatement visitDoStatement(DoStatement node) => new DoStatement.full(node.do Keyword, clone2(node.body), node.whileKeyword, node.leftParenthesis, clone2(node .condition), node.rightParenthesis, node.semicolon); 14516 DoStatement visitDoStatement(DoStatement node) => new DoStatement.full(node.do Keyword, clone2(node.body), node.whileKeyword, node.leftParenthesis, clone2(node .condition), node.rightParenthesis, node.semicolon);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
14716 bool isInRange(ASTNode node) { 14755 bool isInRange(ASTNode node) {
14717 if (_position < 0) { 14756 if (_position < 0) {
14718 return true; 14757 return true;
14719 } 14758 }
14720 return node.end < _position; 14759 return node.end < _position;
14721 } 14760 }
14722 } 14761 }
14723 /** 14762 /**
14724 * Instances of the class {@code NodeList} represent a list of AST nodes that ha ve a common parent. 14763 * Instances of the class {@code NodeList} represent a list of AST nodes that ha ve a common parent.
14725 */ 14764 */
14726 class NodeList<E extends ASTNode> extends ListWrapper<E> { 14765 class NodeList<E extends ASTNode> extends Object with ListMixin<E> {
14766 /**
14767 * Create an empty list with the given owner. This is a convenience method tha t allows the
14768 * compiler to determine the correct value of the type argument [E] without ne eding to
14769 * explicitly specify it.
14770 *
14771 * @param owner the node that is the parent of each of the elements in the lis t
14772 * @return the list that was created
14773 */
14774 static NodeList create(ASTNode owner) => new NodeList(owner);
14775
14727 /** 14776 /**
14728 * The node that is the parent of each of the elements in the list. 14777 * The node that is the parent of each of the elements in the list.
14729 */ 14778 */
14730 ASTNode owner; 14779 ASTNode owner;
14780
14731 /** 14781 /**
14732 * The elements of the list. 14782 * The elements contained in the list.
14733 */ 14783 */
14734 List<E> elements = new List<E>(); 14784 List<E> _elements = <E> [];
14785
14735 /** 14786 /**
14736 * Initialize a newly created list of nodes to be empty. 14787 * Initialize a newly created list of nodes to be empty.
14788 *
14737 * @param owner the node that is the parent of each of the elements in the lis t 14789 * @param owner the node that is the parent of each of the elements in the lis t
14738 */ 14790 */
14739 NodeList(ASTNode this.owner); 14791 NodeList(this.owner);
14792
14740 /** 14793 /**
14741 * Use the given visitor to visit each of the nodes in this list. 14794 * Use the given visitor to visit each of the nodes in this list.
14795 *
14742 * @param visitor the visitor to be used to visit the elements of this list 14796 * @param visitor the visitor to be used to visit the elements of this list
14743 */ 14797 */
14744 accept(ASTVisitor visitor) { 14798 accept(ASTVisitor visitor) {
14745 for (E element in elements) { 14799 for (E element in _elements) {
14746 element.accept(visitor); 14800 element.accept(visitor);
14747 } 14801 }
14748 } 14802 }
14749 void add(E node) { 14803 void add(E node) {
14804 insert(length, node);
14805 }
14806 void insert(int index, E node) {
14807 int length = _elements.length;
14808 if (index < 0 || index > length) {
14809 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
14810 }
14750 owner.becomeParentOf(node); 14811 owner.becomeParentOf(node);
14751 elements.add(node); 14812 if (length == 0) {
14813 _elements = <E> [node];
14814 } else {
14815 List<E> newElements = new List<E>(length + 1);
14816 JavaSystem.arraycopy(_elements, 0, newElements, 0, index);
14817 newElements[index] = node;
14818 JavaSystem.arraycopy(_elements, index, newElements, index + 1, length - in dex);
14819 _elements = newElements;
14820 }
14752 } 14821 }
14753 bool addAll(Iterable<E> nodes) { 14822 bool addAll(Iterable<E> nodes) {
14754 if (nodes != null) { 14823 if (nodes != null && !nodes.isEmpty) {
14824 int oldCount = _elements.length;
14825 int newCount = nodes.length;
14826 List<E> newElements = new List<E>(oldCount + newCount);
14827 JavaSystem.arraycopy(_elements, 0, newElements, 0, oldCount);
14828 int index = oldCount;
14755 for (E node in nodes) { 14829 for (E node in nodes) {
14756 add(node); 14830 owner.becomeParentOf(node);
14831 newElements[index++] = node;
14757 } 14832 }
14833 _elements = newElements;
14758 return true; 14834 return true;
14759 } 14835 }
14760 return false; 14836 return false;
14761 } 14837 }
14838 E operator[](int index) {
14839 if (index < 0 || index >= _elements.length) {
14840 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
14841 }
14842 return _elements[index] as E;
14843 }
14844
14762 /** 14845 /**
14763 * Return the first token included in this node's source range. 14846 * Return the first token included in this node's source range.
14847 *
14764 * @return the first token included in this node's source range 14848 * @return the first token included in this node's source range
14765 */ 14849 */
14766 Token get beginToken { 14850 Token get beginToken {
14767 if (elements.isEmpty) { 14851 if (_elements.length == 0) {
14768 return null; 14852 return null;
14769 } 14853 }
14770 return elements[0].beginToken; 14854 return _elements[0].beginToken;
14771 } 14855 }
14856
14772 /** 14857 /**
14773 * Return the last token included in this node list's source range. 14858 * Return the last token included in this node list's source range.
14859 *
14774 * @return the last token included in this node list's source range 14860 * @return the last token included in this node list's source range
14775 */ 14861 */
14776 Token get endToken { 14862 Token get endToken {
14777 if (elements.isEmpty) { 14863 if (_elements.length == 0) {
14778 return null; 14864 return null;
14779 } 14865 }
14780 return elements[elements.length - 1].endToken; 14866 return _elements[_elements.length - 1].endToken;
14781 } 14867 }
14782 /** 14868 E removeAt(int index) {
14783 * Return the node that is the parent of each of the elements in the list. 14869 if (index < 0 || index >= _elements.length) {
14784 * @return the node that is the parent of each of the elements in the list 14870 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
14785 */ 14871 }
14786 ASTNode getOwner() { 14872 E removedNode = _elements[index] as E;
14787 return owner; 14873 int length = _elements.length;
14874 if (length == 1) {
14875 _elements = ASTNode.EMPTY_ARRAY;
14876 return removedNode;
14877 }
14878 List<E> newElements = new List<E>(length - 1);
14879 JavaSystem.arraycopy(_elements, 0, newElements, 0, index);
14880 JavaSystem.arraycopy(_elements, index + 1, newElements, index, length - inde x - 1);
14881 _elements = newElements;
14882 return removedNode;
14788 } 14883 }
14884 void operator[]=(int index, E node) {
14885 if (index < 0 || index >= _elements.length) {
14886 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
14887 }
14888 _elements[index] as E;
14889 owner.becomeParentOf(node);
14890 _elements[index] = node;
14891 }
14892 int get length => _elements.length;
14789 } 14893 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/analyzer_impl.dart ('k') | pkg/analyzer_experimental/lib/src/generated/constant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698