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

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

Issue 24481002: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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'; 7 import 'error.dart';
8 import 'source.dart' show LineInfo; 8 import 'source.dart' show LineInfo;
9 import 'scanner.dart'; 9 import 'scanner.dart';
10 import 'engine.dart' show AnalysisEngine; 10 import 'engine.dart' show AnalysisEngine;
(...skipping 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 * The parsing errors encountered when the receiver was parsed. 2788 * The parsing errors encountered when the receiver was parsed.
2789 */ 2789 */
2790 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; 2790 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS;
2791 2791
2792 /** 2792 /**
2793 * The resolution errors encountered when the receiver was resolved. 2793 * The resolution errors encountered when the receiver was resolved.
2794 */ 2794 */
2795 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; 2795 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS;
2796 2796
2797 /** 2797 /**
2798 * The hints reported when the receiver was analyzed.
2799 */
2800 List<AnalysisError> _hints = AnalysisError.NO_ERRORS;
2801
2802 /**
2798 * Initialize a newly created compilation unit to have the given directives an d declarations. 2803 * Initialize a newly created compilation unit to have the given directives an d declarations.
2799 * 2804 *
2800 * @param beginToken the first token in the token stream 2805 * @param beginToken the first token in the token stream
2801 * @param scriptTag the script tag at the beginning of the compilation unit 2806 * @param scriptTag the script tag at the beginning of the compilation unit
2802 * @param directives the directives contained in this compilation unit 2807 * @param directives the directives contained in this compilation unit
2803 * @param declarations the declarations contained in this compilation unit 2808 * @param declarations the declarations contained in this compilation unit
2804 * @param endToken the last token in the token stream 2809 * @param endToken the last token in the token stream
2805 */ 2810 */
2806 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di rectives, List<CompilationUnitMember> declarations, Token endToken) { 2811 CompilationUnit.full(Token beginToken, ScriptTag scriptTag, List<Directive> di rectives, List<CompilationUnitMember> declarations, Token endToken) {
2807 this.directives = new NodeList<Directive>(this); 2812 this.directives = new NodeList<Directive>(this);
(...skipping 21 matching lines...) Expand all
2829 2834
2830 /** 2835 /**
2831 * Return an array containing all of the errors associated with the receiver. The array will be 2836 * Return an array containing all of the errors associated with the receiver. The array will be
2832 * empty if the receiver has not been resolved and there were no parse errors. 2837 * empty if the receiver has not been resolved and there were no parse errors.
2833 * 2838 *
2834 * @return the errors associated with the receiver 2839 * @return the errors associated with the receiver
2835 */ 2840 */
2836 List<AnalysisError> get errors { 2841 List<AnalysisError> get errors {
2837 List<AnalysisError> parserErrors = parsingErrors; 2842 List<AnalysisError> parserErrors = parsingErrors;
2838 List<AnalysisError> resolverErrors = resolutionErrors; 2843 List<AnalysisError> resolverErrors = resolutionErrors;
2839 if (resolverErrors.length == 0) { 2844 List<AnalysisError> hints = this.hints;
2845 if (resolverErrors.length == 0 && hints.length == 0) {
2840 return parserErrors; 2846 return parserErrors;
2841 } else if (parserErrors.length == 0) { 2847 } else if (parserErrors.length == 0 && hints.length == 0) {
2842 return resolverErrors; 2848 return resolverErrors;
2849 } else if (parserErrors.length == 0 && resolverErrors.length == 0) {
2850 return hints;
2843 } else { 2851 } else {
2844 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length); 2852 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length + hints.length);
2845 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); 2853 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length);
2846 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re solverErrors.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);
2847 return allErrors; 2856 return allErrors;
2848 } 2857 }
2849 } 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;
2850 int get length { 2867 int get length {
2851 Token endToken = this.endToken; 2868 Token endToken = this.endToken;
2852 if (endToken == null) { 2869 if (endToken == null) {
2853 return 0; 2870 return 0;
2854 } 2871 }
2855 return endToken.offset + endToken.length; 2872 return endToken.offset + endToken.length;
2856 } 2873 }
2857 int get offset => 0; 2874 int get offset => 0;
2858 2875
2859 /** 2876 /**
(...skipping 13 matching lines...) Expand all
2873 2890
2874 /** 2891 /**
2875 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no 2892 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no
2876 * script tag in this compilation unit. 2893 * script tag in this compilation unit.
2877 * 2894 *
2878 * @return the script tag at the beginning of the compilation unit 2895 * @return the script tag at the beginning of the compilation unit
2879 */ 2896 */
2880 ScriptTag get scriptTag => _scriptTag; 2897 ScriptTag get scriptTag => _scriptTag;
2881 2898
2882 /** 2899 /**
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 /**
2883 * Set the parse errors associated with this compilation unit to the given err ors. 2909 * Set the parse errors associated with this compilation unit to the given err ors.
2884 * 2910 *
2885 * @param the parse errors to be associated with this compilation unit 2911 * @param the parse errors to be associated with this compilation unit
2886 */ 2912 */
2887 void set parsingErrors(List<AnalysisError> errors) { 2913 void set parsingErrors(List<AnalysisError> errors) {
2888 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; 2914 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
2889 } 2915 }
2890 2916
2891 /** 2917 /**
2892 * Set the resolution errors associated with this compilation unit to the give n errors. 2918 * Set the resolution errors associated with this compilation unit to the give n errors.
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 SimpleIdentifier _name; 3579 SimpleIdentifier _name;
3554 3580
3555 /** 3581 /**
3556 * The element associated with this constructor name based on static type info rmation, or 3582 * The element associated with this constructor name based on static type info rmation, or
3557 * `null` if the AST structure has not been resolved or if this constructor na me could not 3583 * `null` if the AST structure has not been resolved or if this constructor na me could not
3558 * be resolved. 3584 * be resolved.
3559 */ 3585 */
3560 ConstructorElement _staticElement; 3586 ConstructorElement _staticElement;
3561 3587
3562 /** 3588 /**
3563 * The element associated with this constructor name based on propagated type information, or
3564 * `null` if the AST structure has not been resolved or if this constructor na me could not
3565 * be resolved.
3566 */
3567 ConstructorElement _propagatedElement;
3568
3569 /**
3570 * Initialize a newly created constructor name. 3589 * Initialize a newly created constructor name.
3571 * 3590 *
3572 * @param type the name of the type defining the constructor 3591 * @param type the name of the type defining the constructor
3573 * @param period the token for the period before the constructor name 3592 * @param period the token for the period before the constructor name
3574 * @param name the name of the constructor 3593 * @param name the name of the constructor
3575 */ 3594 */
3576 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) { 3595 ConstructorName.full(TypeName type, Token period, SimpleIdentifier name) {
3577 this._type = becomeParentOf(type); 3596 this._type = becomeParentOf(type);
3578 this.period = period; 3597 this.period = period;
3579 this._name = becomeParentOf(name); 3598 this._name = becomeParentOf(name);
3580 } 3599 }
3581 3600
3582 /** 3601 /**
3583 * Initialize a newly created constructor name. 3602 * Initialize a newly created constructor name.
3584 * 3603 *
3585 * @param type the name of the type defining the constructor 3604 * @param type the name of the type defining the constructor
3586 * @param period the token for the period before the constructor name 3605 * @param period the token for the period before the constructor name
3587 * @param name the name of the constructor 3606 * @param name the name of the constructor
3588 */ 3607 */
3589 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f ull(type, period, name); 3608 ConstructorName({TypeName type, Token period, SimpleIdentifier name}) : this.f ull(type, period, name);
3590 accept(ASTVisitor visitor) => visitor.visitConstructorName(this); 3609 accept(ASTVisitor visitor) => visitor.visitConstructorName(this);
3591 Token get beginToken => _type.beginToken; 3610 Token get beginToken => _type.beginToken;
3592
3593 /**
3594 * Return the element associated with this constructor name based on propagate d type information,
3595 * or `null` if the AST structure has not been resolved or if this constructor name could
3596 * not be resolved.
3597 *
3598 * @return the element associated with this constructor name
3599 */
3600 ConstructorElement get element => _propagatedElement;
3601 Token get endToken { 3611 Token get endToken {
3602 if (_name != null) { 3612 if (_name != null) {
3603 return _name.endToken; 3613 return _name.endToken;
3604 } 3614 }
3605 return _type.endToken; 3615 return _type.endToken;
3606 } 3616 }
3607 3617
3608 /** 3618 /**
3609 * Return the name of the constructor, or `null` if the specified constructor is the unnamed 3619 * Return the name of the constructor, or `null` if the specified constructor is the unnamed
3610 * constructor. 3620 * constructor.
(...skipping 12 matching lines...) Expand all
3623 ConstructorElement get staticElement => _staticElement; 3633 ConstructorElement get staticElement => _staticElement;
3624 3634
3625 /** 3635 /**
3626 * Return the name of the type defining the constructor. 3636 * Return the name of the type defining the constructor.
3627 * 3637 *
3628 * @return the name of the type defining the constructor 3638 * @return the name of the type defining the constructor
3629 */ 3639 */
3630 TypeName get type => _type; 3640 TypeName get type => _type;
3631 3641
3632 /** 3642 /**
3633 * Set the element associated with this constructor name based on propagated t ype information to
3634 * the given element.
3635 *
3636 * @param element the element to be associated with this constructor name
3637 */
3638 void set element(ConstructorElement element2) {
3639 _propagatedElement = element2;
3640 }
3641
3642 /**
3643 * Set the name of the constructor to the given name. 3643 * Set the name of the constructor to the given name.
3644 * 3644 *
3645 * @param name the name of the constructor 3645 * @param name the name of the constructor
3646 */ 3646 */
3647 void set name(SimpleIdentifier name2) { 3647 void set name(SimpleIdentifier name2) {
3648 this._name = becomeParentOf(name2); 3648 this._name = becomeParentOf(name2);
3649 } 3649 }
3650 3650
3651 /** 3651 /**
3652 * Set the element associated with this constructor name based on static type information to the 3652 * Set the element associated with this constructor name based on static type information to the
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
4412 */ 4412 */
4413 Type2 staticType; 4413 Type2 staticType;
4414 4414
4415 /** 4415 /**
4416 * The propagated type of this expression, or `null` if type propagation has n ot been 4416 * The propagated type of this expression, or `null` if type propagation has n ot been
4417 * performed on the AST structure. 4417 * performed on the AST structure.
4418 */ 4418 */
4419 Type2 propagatedType; 4419 Type2 propagatedType;
4420 4420
4421 /** 4421 /**
4422 * Return the best parameter element information available for this expression . If type
4423 * propagation was able to find a better parameter element than static analysi s, that type will be
4424 * returned. Otherwise, the result of static analysis will be returned.
4425 *
4426 * @return the parameter element representing the parameter to which the value of this expression
4427 * will be bound
4428 */
4429 ParameterElement get bestParameterElement {
4430 ParameterElement propagatedElement = propagatedParameterElement;
4431 if (propagatedElement != null) {
4432 return propagatedElement;
4433 }
4434 return staticParameterElement;
4435 }
4436
4437 /**
4422 * Return the best type information available for this expression. If type pro pagation was able to 4438 * Return the best type information available for this expression. If type pro pagation was able to
4423 * find a better type than static analysis, that type will be returned. Otherw ise, the result of 4439 * find a better type than static analysis, that type will be returned. Otherw ise, the result of
4424 * static analysis will be returned. If no type analysis has been performed, t hen the type 4440 * static analysis will be returned. If no type analysis has been performed, t hen the type
4425 * 'dynamic' will be returned. 4441 * 'dynamic' will be returned.
4426 * 4442 *
4427 * @return the best type information available for this expression 4443 * @return the best type information available for this expression
4428 */ 4444 */
4429 Type2 get bestType { 4445 Type2 get bestType {
4430 if (propagatedType != null) { 4446 if (propagatedType != null) {
4431 return propagatedType; 4447 return propagatedType;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
4947 safelyVisitChild(_type, visitor); 4963 safelyVisitChild(_type, visitor);
4948 safelyVisitChild(identifier, visitor); 4964 safelyVisitChild(identifier, visitor);
4949 safelyVisitChild(_parameters, visitor); 4965 safelyVisitChild(_parameters, visitor);
4950 } 4966 }
4951 } 4967 }
4952 /** 4968 /**
4953 * Instances of the class `ForEachStatement` represent a for-each statement. 4969 * Instances of the class `ForEachStatement` represent a for-each statement.
4954 * 4970 *
4955 * <pre> 4971 * <pre>
4956 * forEachStatement ::= 4972 * forEachStatement ::=
4957 * 'for' '(' [SimpleFormalParameter] 'in' [Expression] ')' [Block] 4973 * 'for' '(' [DeclaredIdentifier] 'in' [Expression] ')' [Block]
4974 * | 'for' '(' [SimpleIdentifier] 'in' [Expression] ')' [Block]
4958 * </pre> 4975 * </pre>
4959 * 4976 *
4960 * @coverage dart.engine.ast 4977 * @coverage dart.engine.ast
4961 */ 4978 */
4962 class ForEachStatement extends Statement { 4979 class ForEachStatement extends Statement {
4963 4980
4964 /** 4981 /**
4965 * The token representing the 'for' keyword. 4982 * The token representing the 'for' keyword.
4966 */ 4983 */
4967 Token forKeyword; 4984 Token forKeyword;
4968 4985
4969 /** 4986 /**
4970 * The left parenthesis. 4987 * The left parenthesis.
4971 */ 4988 */
4972 Token leftParenthesis; 4989 Token leftParenthesis;
4973 4990
4974 /** 4991 /**
4975 * The declaration of the loop variable. 4992 * The declaration of the loop variable, or `null` if the loop variable is a s imple
4993 * identifier.
4976 */ 4994 */
4977 DeclaredIdentifier _loopVariable; 4995 DeclaredIdentifier _loopVariable;
4978 4996
4979 /** 4997 /**
4998 * The loop variable, or `null` if the loop variable is declared in the 'for'.
4999 */
5000 SimpleIdentifier _identifier;
5001
5002 /**
4980 * The token representing the 'in' keyword. 5003 * The token representing the 'in' keyword.
4981 */ 5004 */
4982 Token inKeyword; 5005 Token inKeyword;
4983 5006
4984 /** 5007 /**
4985 * The expression evaluated to produce the iterator. 5008 * The expression evaluated to produce the iterator.
4986 */ 5009 */
4987 Expression _iterator; 5010 Expression _iterator;
4988 5011
4989 /** 5012 /**
4990 * The right parenthesis. 5013 * The right parenthesis.
4991 */ 5014 */
4992 Token rightParenthesis; 5015 Token rightParenthesis;
4993 5016
4994 /** 5017 /**
4995 * The body of the loop. 5018 * The body of the loop.
4996 */ 5019 */
4997 Statement _body; 5020 Statement _body;
4998 5021
4999 /** 5022 /**
5000 * Initialize a newly created for-each statement. 5023 * Initialize a newly created for-each statement.
5001 * 5024 *
5002 * @param forKeyword the token representing the 'for' keyword 5025 * @param forKeyword the token representing the 'for' keyword
5003 * @param leftParenthesis the left parenthesis 5026 * @param leftParenthesis the left parenthesis
5004 * @param loopVariable the declaration of the loop variable 5027 * @param loopVariable the declaration of the loop variable
5005 * @param iterator the expression evaluated to produce the iterator 5028 * @param iterator the expression evaluated to produce the iterator
5006 * @param rightParenthesis the right parenthesis 5029 * @param rightParenthesis the right parenthesis
5007 * @param body the body of the loop 5030 * @param body the body of the loop
5008 */ 5031 */
5009 ForEachStatement.full(Token forKeyword, Token leftParenthesis, DeclaredIdentif ier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Statement body) { 5032 ForEachStatement.con1_full(Token forKeyword, Token leftParenthesis, DeclaredId entifier loopVariable, Token inKeyword, Expression iterator, Token rightParenthe sis, Statement body) {
5010 this.forKeyword = forKeyword; 5033 this.forKeyword = forKeyword;
5011 this.leftParenthesis = leftParenthesis; 5034 this.leftParenthesis = leftParenthesis;
5012 this._loopVariable = becomeParentOf(loopVariable); 5035 this._loopVariable = becomeParentOf(loopVariable);
5013 this.inKeyword = inKeyword; 5036 this.inKeyword = inKeyword;
5014 this._iterator = becomeParentOf(iterator); 5037 this._iterator = becomeParentOf(iterator);
5015 this.rightParenthesis = rightParenthesis; 5038 this.rightParenthesis = rightParenthesis;
5016 this._body = becomeParentOf(body); 5039 this._body = becomeParentOf(body);
5017 } 5040 }
5018 5041
5019 /** 5042 /**
5020 * Initialize a newly created for-each statement. 5043 * Initialize a newly created for-each statement.
5021 * 5044 *
5022 * @param forKeyword the token representing the 'for' keyword 5045 * @param forKeyword the token representing the 'for' keyword
5023 * @param leftParenthesis the left parenthesis 5046 * @param leftParenthesis the left parenthesis
5024 * @param loopVariable the declaration of the loop variable 5047 * @param loopVariable the declaration of the loop variable
5025 * @param iterator the expression evaluated to produce the iterator 5048 * @param iterator the expression evaluated to produce the iterator
5026 * @param rightParenthesis the right parenthesis 5049 * @param rightParenthesis the right parenthesis
5027 * @param body the body of the loop 5050 * @param body the body of the loop
5028 */ 5051 */
5029 ForEachStatement({Token forKeyword, Token leftParenthesis, DeclaredIdentifier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Stat ement body}) : this.full(forKeyword, leftParenthesis, loopVariable, inKeyword, i terator, rightParenthesis, body); 5052 ForEachStatement.con1({Token forKeyword, Token leftParenthesis, DeclaredIdenti fier loopVariable, Token inKeyword, Expression iterator, Token rightParenthesis, Statement body}) : this.con1_full(forKeyword, leftParenthesis, loopVariable, in Keyword, iterator, rightParenthesis, body);
5053
5054 /**
5055 * Initialize a newly created for-each statement.
5056 *
5057 * @param forKeyword the token representing the 'for' keyword
5058 * @param leftParenthesis the left parenthesis
5059 * @param identifier the loop variable
5060 * @param iterator the expression evaluated to produce the iterator
5061 * @param rightParenthesis the right parenthesis
5062 * @param body the body of the loop
5063 */
5064 ForEachStatement.con2_full(Token forKeyword, Token leftParenthesis, SimpleIden tifier identifier, Token inKeyword, Expression iterator, Token rightParenthesis, Statement body) {
5065 this.forKeyword = forKeyword;
5066 this.leftParenthesis = leftParenthesis;
5067 this._identifier = becomeParentOf(identifier);
5068 this.inKeyword = inKeyword;
5069 this._iterator = becomeParentOf(iterator);
5070 this.rightParenthesis = rightParenthesis;
5071 this._body = becomeParentOf(body);
5072 }
5073
5074 /**
5075 * Initialize a newly created for-each statement.
5076 *
5077 * @param forKeyword the token representing the 'for' keyword
5078 * @param leftParenthesis the left parenthesis
5079 * @param identifier the loop variable
5080 * @param iterator the expression evaluated to produce the iterator
5081 * @param rightParenthesis the right parenthesis
5082 * @param body the body of the loop
5083 */
5084 ForEachStatement.con2({Token forKeyword, Token leftParenthesis, SimpleIdentifi er identifier, Token inKeyword, Expression iterator, Token rightParenthesis, Sta tement body}) : this.con2_full(forKeyword, leftParenthesis, identifier, inKeywor d, iterator, rightParenthesis, body);
5030 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this); 5085 accept(ASTVisitor visitor) => visitor.visitForEachStatement(this);
5031 Token get beginToken => forKeyword; 5086 Token get beginToken => forKeyword;
5032 5087
5033 /** 5088 /**
5034 * Return the body of the loop. 5089 * Return the body of the loop.
5035 * 5090 *
5036 * @return the body of the loop 5091 * @return the body of the loop
5037 */ 5092 */
5038 Statement get body => _body; 5093 Statement get body => _body;
5039 Token get endToken => _body.endToken; 5094 Token get endToken => _body.endToken;
5040 5095
5041 /** 5096 /**
5097 * Return the loop variable, or `null` if the loop variable is declared in the 'for'.
5098 *
5099 * @return the loop variable
5100 */
5101 SimpleIdentifier get identifier => _identifier;
5102
5103 /**
5042 * Return the expression evaluated to produce the iterator. 5104 * Return the expression evaluated to produce the iterator.
5043 * 5105 *
5044 * @return the expression evaluated to produce the iterator 5106 * @return the expression evaluated to produce the iterator
5045 */ 5107 */
5046 Expression get iterator => _iterator; 5108 Expression get iterator => _iterator;
5047 5109
5048 /** 5110 /**
5049 * Return the declaration of the loop variable. 5111 * Return the declaration of the loop variable, or `null` if the loop variable is a simple
5112 * identifier.
5050 * 5113 *
5051 * @return the declaration of the loop variable 5114 * @return the declaration of the loop variable
5052 */ 5115 */
5053 DeclaredIdentifier get loopVariable => _loopVariable; 5116 DeclaredIdentifier get loopVariable => _loopVariable;
5054 5117
5055 /** 5118 /**
5056 * Set the body of the loop to the given block. 5119 * Set the body of the loop to the given block.
5057 * 5120 *
5058 * @param body the body of the loop 5121 * @param body the body of the loop
5059 */ 5122 */
5060 void set body(Statement body2) { 5123 void set body(Statement body2) {
5061 this._body = becomeParentOf(body2); 5124 this._body = becomeParentOf(body2);
5062 } 5125 }
5063 5126
5064 /** 5127 /**
5128 * Set the loop variable to the given variable.
5129 *
5130 * @param identifier the loop variable
5131 */
5132 void set identifier(SimpleIdentifier identifier2) {
5133 this._identifier = becomeParentOf(identifier2);
5134 }
5135
5136 /**
5065 * Set the expression evaluated to produce the iterator to the given expressio n. 5137 * Set the expression evaluated to produce the iterator to the given expressio n.
5066 * 5138 *
5067 * @param expression the expression evaluated to produce the iterator 5139 * @param expression the expression evaluated to produce the iterator
5068 */ 5140 */
5069 void set iterator(Expression expression) { 5141 void set iterator(Expression expression) {
5070 _iterator = becomeParentOf(expression); 5142 _iterator = becomeParentOf(expression);
5071 } 5143 }
5072 5144
5073 /** 5145 /**
5074 * Set the declaration of the loop variable to the given variable. 5146 * Set the declaration of the loop variable to the given variable.
5075 * 5147 *
5076 * @param variable the declaration of the loop variable 5148 * @param variable the declaration of the loop variable
5077 */ 5149 */
5078 void set loopVariable(DeclaredIdentifier variable) { 5150 void set loopVariable(DeclaredIdentifier variable) {
5079 _loopVariable = becomeParentOf(variable); 5151 _loopVariable = becomeParentOf(variable);
5080 } 5152 }
5081 void visitChildren(ASTVisitor visitor) { 5153 void visitChildren(ASTVisitor visitor) {
5082 safelyVisitChild(_loopVariable, visitor); 5154 safelyVisitChild(_loopVariable, visitor);
5155 safelyVisitChild(_identifier, visitor);
5083 safelyVisitChild(_iterator, visitor); 5156 safelyVisitChild(_iterator, visitor);
5084 safelyVisitChild(_body, visitor); 5157 safelyVisitChild(_body, visitor);
5085 } 5158 }
5086 } 5159 }
5087 /** 5160 /**
5088 * Instances of the class `ForStatement` represent a for statement. 5161 * Instances of the class `ForStatement` represent a for statement.
5089 * 5162 *
5090 * <pre> 5163 * <pre>
5091 * forStatement ::= 5164 * forStatement ::=
5092 * 'for' '(' forLoopParts ')' [Statement] 5165 * 'for' '(' forLoopParts ')' [Statement]
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
6513 * Instances of the class `ImportDirective` represent an import directive. 6586 * Instances of the class `ImportDirective` represent an import directive.
6514 * 6587 *
6515 * <pre> 6588 * <pre>
6516 * importDirective ::= 6589 * importDirective ::=
6517 * [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* '; ' 6590 * [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* '; '
6518 * </pre> 6591 * </pre>
6519 * 6592 *
6520 * @coverage dart.engine.ast 6593 * @coverage dart.engine.ast
6521 */ 6594 */
6522 class ImportDirective extends NamespaceDirective { 6595 class ImportDirective extends NamespaceDirective {
6596 static Comparator<ImportDirective> COMPARATOR = (ImportDirective import1, Impo rtDirective import2) {
6597 StringLiteral uri1 = import1.uri;
6598 StringLiteral uri2 = import2.uri;
6599 String uriStr1 = uri1.stringValue;
6600 String uriStr2 = uri2.stringValue;
6601 if (uriStr1 != null || uriStr2 != null) {
6602 if (uriStr1 == null) {
6603 return -1;
6604 } else if (uriStr2 == null) {
6605 return 1;
6606 } else {
6607 int compare = uriStr1.compareTo(uriStr2);
6608 if (compare != 0) {
6609 return compare;
6610 }
6611 }
6612 }
6613 SimpleIdentifier prefix1 = import1.prefix;
6614 SimpleIdentifier prefix2 = import2.prefix;
6615 String prefixStr1 = prefix1 != null ? prefix1.name : null;
6616 String prefixStr2 = prefix2 != null ? prefix2.name : null;
6617 if (prefixStr1 != null || prefixStr2 != null) {
6618 if (prefixStr1 == null) {
6619 return -1;
6620 } else if (prefixStr2 == null) {
6621 return 1;
6622 } else {
6623 int compare = prefixStr1.compareTo(prefixStr2);
6624 if (compare != 0) {
6625 return compare;
6626 }
6627 }
6628 }
6629 NodeList<Combinator> combinators1 = import1.combinators;
6630 List<String> allHides1 = new List<String>();
6631 List<String> allShows1 = new List<String>();
6632 for (Combinator combinator in combinators1) {
6633 if (combinator is HideCombinator) {
6634 NodeList<SimpleIdentifier> hides = ((combinator as HideCombinator)).hidd enNames;
6635 for (SimpleIdentifier simpleIdentifier in hides) {
6636 allHides1.add(simpleIdentifier.name);
6637 }
6638 } else {
6639 NodeList<SimpleIdentifier> shows = ((combinator as ShowCombinator)).show nNames;
6640 for (SimpleIdentifier simpleIdentifier in shows) {
6641 allShows1.add(simpleIdentifier.name);
6642 }
6643 }
6644 }
6645 NodeList<Combinator> combinators2 = import2.combinators;
6646 List<String> allHides2 = new List<String>();
6647 List<String> allShows2 = new List<String>();
6648 for (Combinator combinator in combinators2) {
6649 if (combinator is HideCombinator) {
6650 NodeList<SimpleIdentifier> hides = ((combinator as HideCombinator)).hidd enNames;
6651 for (SimpleIdentifier simpleIdentifier in hides) {
6652 allHides2.add(simpleIdentifier.name);
6653 }
6654 } else {
6655 NodeList<SimpleIdentifier> shows = ((combinator as ShowCombinator)).show nNames;
6656 for (SimpleIdentifier simpleIdentifier in shows) {
6657 allShows2.add(simpleIdentifier.name);
6658 }
6659 }
6660 }
6661 if (allHides1.length != allHides2.length) {
6662 return allHides1.length - allHides2.length;
6663 }
6664 if (allShows1.length != allShows2.length) {
6665 return allShows1.length - allShows2.length;
6666 }
6667 if (!javaCollectionContainsAll(allHides1, allHides2)) {
6668 return -1;
6669 }
6670 if (!javaCollectionContainsAll(allShows1, allShows2)) {
6671 return -1;
6672 }
6673 return 0;
6674 };
6523 6675
6524 /** 6676 /**
6525 * The token representing the 'as' token, or `null` if the imported names are not prefixed. 6677 * The token representing the 'as' token, or `null` if the imported names are not prefixed.
6526 */ 6678 */
6527 Token asToken; 6679 Token asToken;
6528 6680
6529 /** 6681 /**
6530 * The prefix to be used with the imported names, or `null` if the imported na mes are not 6682 * The prefix to be used with the imported names, or `null` if the imported na mes are not
6531 * prefixed. 6683 * prefixed.
6532 */ 6684 */
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
6982 */ 7134 */
6983 ArgumentList _argumentList; 7135 ArgumentList _argumentList;
6984 7136
6985 /** 7137 /**
6986 * The element associated with the constructor based on static type informatio n, or `null` 7138 * The element associated with the constructor based on static type informatio n, or `null`
6987 * if the AST structure has not been resolved or if the constructor could not be resolved. 7139 * if the AST structure has not been resolved or if the constructor could not be resolved.
6988 */ 7140 */
6989 ConstructorElement staticElement; 7141 ConstructorElement staticElement;
6990 7142
6991 /** 7143 /**
6992 * The element associated with the constructor based on propagated type inform ation, or
6993 * `null` if the AST structure has not been resolved or if the constructor cou ld not be
6994 * resolved.
6995 */
6996 ConstructorElement element;
6997
6998 /**
6999 * Initialize a newly created instance creation expression. 7144 * Initialize a newly created instance creation expression.
7000 * 7145 *
7001 * @param keyword the keyword used to indicate how an object should be created 7146 * @param keyword the keyword used to indicate how an object should be created
7002 * @param constructorName the name of the constructor to be invoked 7147 * @param constructorName the name of the constructor to be invoked
7003 * @param argumentList the list of arguments to the constructor 7148 * @param argumentList the list of arguments to the constructor
7004 */ 7149 */
7005 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName , ArgumentList argumentList) { 7150 InstanceCreationExpression.full(Token keyword, ConstructorName constructorName , ArgumentList argumentList) {
7006 this.keyword = keyword; 7151 this.keyword = keyword;
7007 this.constructorName = becomeParentOf(constructorName); 7152 this.constructorName = becomeParentOf(constructorName);
7008 this._argumentList = becomeParentOf(argumentList); 7153 this._argumentList = becomeParentOf(argumentList);
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
9662 */ 9807 */
9663 ArgumentList _argumentList; 9808 ArgumentList _argumentList;
9664 9809
9665 /** 9810 /**
9666 * The element associated with the constructor based on static type informatio n, or `null` 9811 * The element associated with the constructor based on static type informatio n, or `null`
9667 * if the AST structure has not been resolved or if the constructor could not be resolved. 9812 * if the AST structure has not been resolved or if the constructor could not be resolved.
9668 */ 9813 */
9669 ConstructorElement staticElement; 9814 ConstructorElement staticElement;
9670 9815
9671 /** 9816 /**
9672 * The element associated with the constructor based on propagated type inform ation, or
9673 * `null` if the AST structure has not been resolved or if the constructor cou ld not be
9674 * resolved.
9675 */
9676 ConstructorElement _propagatedElement;
9677
9678 /**
9679 * Initialize a newly created redirecting invocation to invoke the constructor with the given name 9817 * Initialize a newly created redirecting invocation to invoke the constructor with the given name
9680 * with the given arguments. 9818 * with the given arguments.
9681 * 9819 *
9682 * @param keyword the token for the 'this' keyword 9820 * @param keyword the token for the 'this' keyword
9683 * @param period the token for the period before the name of the constructor t hat is being invoked 9821 * @param period the token for the period before the name of the constructor t hat is being invoked
9684 * @param constructorName the name of the constructor that is being invoked 9822 * @param constructorName the name of the constructor that is being invoked
9685 * @param argumentList the list of arguments to the constructor 9823 * @param argumentList the list of arguments to the constructor
9686 */ 9824 */
9687 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent ifier constructorName, ArgumentList argumentList) { 9825 RedirectingConstructorInvocation.full(Token keyword, Token period, SimpleIdent ifier constructorName, ArgumentList argumentList) {
9688 this.keyword = keyword; 9826 this.keyword = keyword;
(...skipping 22 matching lines...) Expand all
9711 ArgumentList get argumentList => _argumentList; 9849 ArgumentList get argumentList => _argumentList;
9712 Token get beginToken => keyword; 9850 Token get beginToken => keyword;
9713 9851
9714 /** 9852 /**
9715 * Return the name of the constructor that is being invoked, or `null` if the unnamed 9853 * Return the name of the constructor that is being invoked, or `null` if the unnamed
9716 * constructor is being invoked. 9854 * constructor is being invoked.
9717 * 9855 *
9718 * @return the name of the constructor that is being invoked 9856 * @return the name of the constructor that is being invoked
9719 */ 9857 */
9720 SimpleIdentifier get constructorName => _constructorName; 9858 SimpleIdentifier get constructorName => _constructorName;
9721
9722 /**
9723 * Return the element associated with the constructor based on propagated type information, or
9724 * `null` if the AST structure has not been resolved or if the constructor cou ld not be
9725 * resolved.
9726 *
9727 * @return the element associated with the super constructor
9728 */
9729 ConstructorElement get element => _propagatedElement;
9730 Token get endToken => _argumentList.endToken; 9859 Token get endToken => _argumentList.endToken;
9731 9860
9732 /** 9861 /**
9733 * Set the list of arguments to the constructor to the given list. 9862 * Set the list of arguments to the constructor to the given list.
9734 * 9863 *
9735 * @param argumentList the list of arguments to the constructor 9864 * @param argumentList the list of arguments to the constructor
9736 */ 9865 */
9737 void set argumentList(ArgumentList argumentList2) { 9866 void set argumentList(ArgumentList argumentList2) {
9738 this._argumentList = becomeParentOf(argumentList2); 9867 this._argumentList = becomeParentOf(argumentList2);
9739 } 9868 }
9740 9869
9741 /** 9870 /**
9742 * Set the name of the constructor that is being invoked to the given identifi er. 9871 * Set the name of the constructor that is being invoked to the given identifi er.
9743 * 9872 *
9744 * @param identifier the name of the constructor that is being invoked 9873 * @param identifier the name of the constructor that is being invoked
9745 */ 9874 */
9746 void set constructorName(SimpleIdentifier identifier) { 9875 void set constructorName(SimpleIdentifier identifier) {
9747 _constructorName = becomeParentOf(identifier); 9876 _constructorName = becomeParentOf(identifier);
9748 } 9877 }
9749
9750 /**
9751 * Set the element associated with the constructor based on propagated type in formation to the
9752 * given element.
9753 *
9754 * @param element the element to be associated with the constructor
9755 */
9756 void set element(ConstructorElement element2) {
9757 _propagatedElement = element2;
9758 }
9759 void visitChildren(ASTVisitor visitor) { 9878 void visitChildren(ASTVisitor visitor) {
9760 safelyVisitChild(_constructorName, visitor); 9879 safelyVisitChild(_constructorName, visitor);
9761 safelyVisitChild(_argumentList, visitor); 9880 safelyVisitChild(_argumentList, visitor);
9762 } 9881 }
9763 } 9882 }
9764 /** 9883 /**
9765 * Instances of the class `RethrowExpression` represent a rethrow expression. 9884 * Instances of the class `RethrowExpression` represent a rethrow expression.
9766 * 9885 *
9767 * <pre> 9886 * <pre>
9768 * rethrowExpression ::= 9887 * rethrowExpression ::=
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
10275 return validateElement(parent, LocalVariableElement, element); 10394 return validateElement(parent, LocalVariableElement, element);
10276 } else if (parent is FormalParameter && identical(((parent as FormalParamete r)).identifier, this)) { 10395 } else if (parent is FormalParameter && identical(((parent as FormalParamete r)).identifier, this)) {
10277 return validateElement(parent, ParameterElement, element); 10396 return validateElement(parent, ParameterElement, element);
10278 } else if (parent is FunctionDeclaration && identical(((parent as FunctionDe claration)).name, this)) { 10397 } else if (parent is FunctionDeclaration && identical(((parent as FunctionDe claration)).name, this)) {
10279 return validateElement(parent, ExecutableElement, element); 10398 return validateElement(parent, ExecutableElement, element);
10280 } else if (parent is FunctionTypeAlias && identical(((parent as FunctionType Alias)).name, this)) { 10399 } else if (parent is FunctionTypeAlias && identical(((parent as FunctionType Alias)).name, this)) {
10281 return validateElement(parent, FunctionTypeAliasElement, element); 10400 return validateElement(parent, FunctionTypeAliasElement, element);
10282 } else if (parent is MethodDeclaration && identical(((parent as MethodDeclar ation)).name, this)) { 10401 } else if (parent is MethodDeclaration && identical(((parent as MethodDeclar ation)).name, this)) {
10283 return validateElement(parent, ExecutableElement, element); 10402 return validateElement(parent, ExecutableElement, element);
10284 } else if (parent is TypeParameter && identical(((parent as TypeParameter)). name, this)) { 10403 } else if (parent is TypeParameter && identical(((parent as TypeParameter)). name, this)) {
10285 return validateElement(parent, TypeVariableElement, element); 10404 return validateElement(parent, TypeParameterElement, element);
10286 } else if (parent is VariableDeclaration && identical(((parent as VariableDe claration)).name, this)) { 10405 } else if (parent is VariableDeclaration && identical(((parent as VariableDe claration)).name, this)) {
10287 return validateElement(parent, VariableElement, element); 10406 return validateElement(parent, VariableElement, element);
10288 } 10407 }
10289 return element; 10408 return element;
10290 } 10409 }
10291 } 10410 }
10292 /** 10411 /**
10293 * Instances of the class `SimpleStringLiteral` represent a string literal expre ssion that 10412 * Instances of the class `SimpleStringLiteral` represent a string literal expre ssion that
10294 * does not contain any interpolations. 10413 * does not contain any interpolations.
10295 * 10414 *
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
10535 */ 10654 */
10536 ArgumentList _argumentList; 10655 ArgumentList _argumentList;
10537 10656
10538 /** 10657 /**
10539 * The element associated with the constructor based on static type informatio n, or `null` 10658 * The element associated with the constructor based on static type informatio n, or `null`
10540 * if the AST structure has not been resolved or if the constructor could not be resolved. 10659 * if the AST structure has not been resolved or if the constructor could not be resolved.
10541 */ 10660 */
10542 ConstructorElement staticElement; 10661 ConstructorElement staticElement;
10543 10662
10544 /** 10663 /**
10545 * The element associated with the constructor based on propagated type inform ation, or `null` if the AST structure has not been
10546 * resolved or if the constructor could not be resolved.
10547 */
10548 ConstructorElement _propagatedElement;
10549
10550 /**
10551 * Initialize a newly created super invocation to invoke the inherited constru ctor with the given 10664 * Initialize a newly created super invocation to invoke the inherited constru ctor with the given
10552 * name with the given arguments. 10665 * name with the given arguments.
10553 * 10666 *
10554 * @param keyword the token for the 'super' keyword 10667 * @param keyword the token for the 'super' keyword
10555 * @param period the token for the period before the name of the constructor t hat is being invoked 10668 * @param period the token for the period before the name of the constructor t hat is being invoked
10556 * @param constructorName the name of the constructor that is being invoked 10669 * @param constructorName the name of the constructor that is being invoked
10557 * @param argumentList the list of arguments to the constructor 10670 * @param argumentList the list of arguments to the constructor
10558 */ 10671 */
10559 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier constructorName, ArgumentList argumentList) { 10672 SuperConstructorInvocation.full(Token keyword, Token period, SimpleIdentifier constructorName, ArgumentList argumentList) {
10560 this.keyword = keyword; 10673 this.keyword = keyword;
(...skipping 22 matching lines...) Expand all
10583 ArgumentList get argumentList => _argumentList; 10696 ArgumentList get argumentList => _argumentList;
10584 Token get beginToken => keyword; 10697 Token get beginToken => keyword;
10585 10698
10586 /** 10699 /**
10587 * Return the name of the constructor that is being invoked, or `null` if the unnamed 10700 * Return the name of the constructor that is being invoked, or `null` if the unnamed
10588 * constructor is being invoked. 10701 * constructor is being invoked.
10589 * 10702 *
10590 * @return the name of the constructor that is being invoked 10703 * @return the name of the constructor that is being invoked
10591 */ 10704 */
10592 SimpleIdentifier get constructorName => _constructorName; 10705 SimpleIdentifier get constructorName => _constructorName;
10593
10594 /**
10595 * Return the element associated with the constructor based on propagated type information, or
10596 * `null` if the AST structure has not been resolved or if the constructor cou ld not be
10597 * resolved.
10598 *
10599 * @return the element associated with the super constructor
10600 */
10601 ConstructorElement get element => _propagatedElement;
10602 Token get endToken => _argumentList.endToken; 10706 Token get endToken => _argumentList.endToken;
10603 10707
10604 /** 10708 /**
10605 * Set the list of arguments to the constructor to the given list. 10709 * Set the list of arguments to the constructor to the given list.
10606 * 10710 *
10607 * @param argumentList the list of arguments to the constructor 10711 * @param argumentList the list of arguments to the constructor
10608 */ 10712 */
10609 void set argumentList(ArgumentList argumentList2) { 10713 void set argumentList(ArgumentList argumentList2) {
10610 this._argumentList = becomeParentOf(argumentList2); 10714 this._argumentList = becomeParentOf(argumentList2);
10611 } 10715 }
10612 10716
10613 /** 10717 /**
10614 * Set the name of the constructor that is being invoked to the given identifi er. 10718 * Set the name of the constructor that is being invoked to the given identifi er.
10615 * 10719 *
10616 * @param identifier the name of the constructor that is being invoked 10720 * @param identifier the name of the constructor that is being invoked
10617 */ 10721 */
10618 void set constructorName(SimpleIdentifier identifier) { 10722 void set constructorName(SimpleIdentifier identifier) {
10619 _constructorName = becomeParentOf(identifier); 10723 _constructorName = becomeParentOf(identifier);
10620 } 10724 }
10621
10622 /**
10623 * Set the element associated with the constructor based on propagated type in formation to the
10624 * given element.
10625 *
10626 * @param element the element to be associated with the constructor
10627 */
10628 void set element(ConstructorElement element2) {
10629 _propagatedElement = element2;
10630 }
10631 void visitChildren(ASTVisitor visitor) { 10725 void visitChildren(ASTVisitor visitor) {
10632 safelyVisitChild(_constructorName, visitor); 10726 safelyVisitChild(_constructorName, visitor);
10633 safelyVisitChild(_argumentList, visitor); 10727 safelyVisitChild(_argumentList, visitor);
10634 } 10728 }
10635 } 10729 }
10636 /** 10730 /**
10637 * Instances of the class `SuperExpression` represent a super expression. 10731 * Instances of the class `SuperExpression` represent a super expression.
10638 * 10732 *
10639 * <pre> 10733 * <pre>
10640 * superExpression ::= 10734 * superExpression ::=
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
11552 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword , bound); 11646 TypeParameter({Comment comment, List<Annotation> metadata, SimpleIdentifier na me, Token keyword, TypeName bound}) : this.full(comment, metadata, name, keyword , bound);
11553 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this); 11647 accept(ASTVisitor visitor) => visitor.visitTypeParameter(this);
11554 11648
11555 /** 11649 /**
11556 * Return the name of the upper bound for legal arguments, or `null` if there was no 11650 * Return the name of the upper bound for legal arguments, or `null` if there was no
11557 * explicit upper bound. 11651 * explicit upper bound.
11558 * 11652 *
11559 * @return the name of the upper bound for legal arguments 11653 * @return the name of the upper bound for legal arguments
11560 */ 11654 */
11561 TypeName get bound => _bound; 11655 TypeName get bound => _bound;
11562 TypeVariableElement get element => _name != null ? (_name.staticElement as Typ eVariableElement) : null; 11656 TypeParameterElement get element => _name != null ? (_name.staticElement as Ty peParameterElement) : null;
11563 Token get endToken { 11657 Token get endToken {
11564 if (_bound == null) { 11658 if (_bound == null) {
11565 return _name.endToken; 11659 return _name.endToken;
11566 } 11660 }
11567 return _bound.endToken; 11661 return _bound.endToken;
11568 } 11662 }
11569 11663
11570 /** 11664 /**
11571 * Return the name of the type parameter. 11665 * Return the name of the type parameter.
11572 * 11666 *
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
12290 while (!_queue.isEmpty) { 12384 while (!_queue.isEmpty) {
12291 ASTNode next = _queue.removeFirst(); 12385 ASTNode next = _queue.removeFirst();
12292 next.accept(this); 12386 next.accept(this);
12293 } 12387 }
12294 } 12388 }
12295 R visitNode(ASTNode node) { 12389 R visitNode(ASTNode node) {
12296 node.visitChildren(_childVisitor); 12390 node.visitChildren(_childVisitor);
12297 return null; 12391 return null;
12298 } 12392 }
12299 BreadthFirstVisitor() { 12393 BreadthFirstVisitor() {
12300 this._childVisitor = new GeneralizingASTVisitor_1(this); 12394 this._childVisitor = new GeneralizingASTVisitor_2(this);
12301 } 12395 }
12302 } 12396 }
12303 class GeneralizingASTVisitor_1 extends GeneralizingASTVisitor<Object> { 12397 class GeneralizingASTVisitor_2 extends GeneralizingASTVisitor<Object> {
12304 final BreadthFirstVisitor BreadthFirstVisitor_this; 12398 final BreadthFirstVisitor BreadthFirstVisitor_this;
12305 GeneralizingASTVisitor_1(this.BreadthFirstVisitor_this) : super(); 12399 GeneralizingASTVisitor_2(this.BreadthFirstVisitor_this) : super();
12306 Object visitNode(ASTNode node) { 12400 Object visitNode(ASTNode node) {
12307 BreadthFirstVisitor_this._queue.add(node); 12401 BreadthFirstVisitor_this._queue.add(node);
12308 return null; 12402 return null;
12309 } 12403 }
12310 } 12404 }
12311 /** 12405 /**
12312 * Instances of the class `ConstantEvaluator` evaluate constant expressions to p roduce their 12406 * Instances of the class `ConstantEvaluator` evaluate constant expressions to p roduce their
12313 * compile-time value. According to the Dart Language Specification: <blockquote > A constant 12407 * compile-time value. According to the Dart Language Specification: <blockquote > A constant
12314 * expression is one of the following: 12408 * expression is one of the following:
12315 * 12409 *
12316 * * A literal number. 12410 * * A literal number.
12317 * * A literal boolean. 12411 * * A literal boolean.
12318 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates 12412 * * A literal string where any interpolated expression is a compile-time consta nt that evaluates
12319 * to a numeric, string or boolean value or to `null`. 12413 * to a numeric, string or boolean value or to `null`.
12320 * * `null`. 12414 * * `null`.
12321 * * A reference to a static constant variable. 12415 * * A reference to a static constant variable.
12322 * * An identifier expression that denotes a constant variable, a class or a typ e variable. 12416 * * An identifier expression that denotes a constant variable, a class or a typ e parameter.
12323 * * A constant constructor invocation. 12417 * * A constant constructor invocation.
12324 * * A constant list literal. 12418 * * A constant list literal.
12325 * * A constant map literal. 12419 * * A constant map literal.
12326 * * A simple or qualified identifier denoting a top-level function or a static method. 12420 * * A simple or qualified identifier denoting a top-level function or a static method.
12327 * * A parenthesized expression `(e)` where `e` is a constant expression. 12421 * * A parenthesized expression `(e)` where `e` is a constant expression.
12328 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`, 12422 * * An expression of one of the forms `identical(e1, e2)`, `e1 == e2`,
12329 * `e1 != e2` where `e1` and `e2` are constant expressions that evaluate to a 12423 * `e1 != e2` where `e1` and `e2` are constant expressions that evaluate to a
12330 * numeric, string or boolean value or to `null`. 12424 * numeric, string or boolean value or to `null`.
12331 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where 12425 * * An expression of one of the forms `!e`, `e1 && e2` or `e1 || e2`, where
12332 * `e`, `e1` and `e2` are constant expressions that evaluate to a boolean value or 12426 * `e`, `e1` and `e2` are constant expressions that evaluate to a boolean value or
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
13725 } 13819 }
13726 Object visitFieldFormalParameter(FieldFormalParameter node) { 13820 Object visitFieldFormalParameter(FieldFormalParameter node) {
13727 visit5(node.keyword, " "); 13821 visit5(node.keyword, " ");
13728 visit2(node.type, " "); 13822 visit2(node.type, " ");
13729 _writer.print("this."); 13823 _writer.print("this.");
13730 visit(node.identifier); 13824 visit(node.identifier);
13731 visit(node.parameters); 13825 visit(node.parameters);
13732 return null; 13826 return null;
13733 } 13827 }
13734 Object visitForEachStatement(ForEachStatement node) { 13828 Object visitForEachStatement(ForEachStatement node) {
13829 DeclaredIdentifier loopVariable = node.loopVariable;
13735 _writer.print("for ("); 13830 _writer.print("for (");
13736 visit(node.loopVariable); 13831 if (loopVariable == null) {
13832 visit(node.identifier);
13833 } else {
13834 visit(loopVariable);
13835 }
13737 _writer.print(" in "); 13836 _writer.print(" in ");
13738 visit(node.iterator); 13837 visit(node.iterator);
13739 _writer.print(") "); 13838 _writer.print(") ");
13740 visit(node.body); 13839 visit(node.body);
13741 return null; 13840 return null;
13742 } 13841 }
13743 Object visitFormalParameterList(FormalParameterList node) { 13842 Object visitFormalParameterList(FormalParameterList node) {
13744 String groupEnd = null; 13843 String groupEnd = null;
13745 _writer.print('('); 13844 _writer.print('(');
13746 NodeList<FormalParameter> parameters = node.parameters; 13845 NodeList<FormalParameter> parameters = node.parameters;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
14358 return Comment.createBlockComment(node.tokens); 14457 return Comment.createBlockComment(node.tokens);
14359 } 14458 }
14360 return Comment.createEndOfLineComment(node.tokens); 14459 return Comment.createEndOfLineComment(node.tokens);
14361 } 14460 }
14362 CommentReference visitCommentReference(CommentReference node) => new CommentRe ference.full(node.newKeyword, clone2(node.identifier)); 14461 CommentReference visitCommentReference(CommentReference node) => new CommentRe ference.full(node.newKeyword, clone2(node.identifier));
14363 CompilationUnit visitCompilationUnit(CompilationUnit node) { 14462 CompilationUnit visitCompilationUnit(CompilationUnit node) {
14364 CompilationUnit clone = new CompilationUnit.full(node.beginToken, clone2(nod e.scriptTag), clone3(node.directives), clone3(node.declarations), node.endToken) ; 14463 CompilationUnit clone = new CompilationUnit.full(node.beginToken, clone2(nod e.scriptTag), clone3(node.directives), clone3(node.declarations), node.endToken) ;
14365 clone.lineInfo = node.lineInfo; 14464 clone.lineInfo = node.lineInfo;
14366 clone.parsingErrors = node.parsingErrors; 14465 clone.parsingErrors = node.parsingErrors;
14367 clone.resolutionErrors = node.resolutionErrors; 14466 clone.resolutionErrors = node.resolutionErrors;
14467 clone.hints = node.hints;
14368 return clone; 14468 return clone;
14369 } 14469 }
14370 ConditionalExpression visitConditionalExpression(ConditionalExpression node) = > new ConditionalExpression.full(clone2(node.condition), node.question, clone2(n ode.thenExpression), node.colon, clone2(node.elseExpression)); 14470 ConditionalExpression visitConditionalExpression(ConditionalExpression node) = > new ConditionalExpression.full(clone2(node.condition), node.question, clone2(n ode.thenExpression), node.colon, clone2(node.elseExpression));
14371 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)); 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));
14372 ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldI nitializer node) => new ConstructorFieldInitializer.full(node.keyword, node.peri od, clone2(node.fieldName), node.equals, clone2(node.expression)); 14472 ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldI nitializer node) => new ConstructorFieldInitializer.full(node.keyword, node.peri od, clone2(node.fieldName), node.equals, clone2(node.expression));
14373 ConstructorName visitConstructorName(ConstructorName node) => new ConstructorN ame.full(clone2(node.type), node.period, clone2(node.name)); 14473 ConstructorName visitConstructorName(ConstructorName node) => new ConstructorN ame.full(clone2(node.type), node.period, clone2(node.name));
14374 ContinueStatement visitContinueStatement(ContinueStatement node) => new Contin ueStatement.full(node.keyword, clone2(node.label), node.semicolon); 14474 ContinueStatement visitContinueStatement(ContinueStatement node) => new Contin ueStatement.full(node.keyword, clone2(node.label), node.semicolon);
14375 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new Dec laredIdentifier.full(clone2(node.documentationComment), clone3(node.metadata), n ode.keyword, clone2(node.type), clone2(node.identifier)); 14475 DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new Dec laredIdentifier.full(clone2(node.documentationComment), clone3(node.metadata), n ode.keyword, clone2(node.type), clone2(node.identifier));
14376 DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node ) => new DefaultFormalParameter.full(clone2(node.parameter), node.kind, node.sep arator, clone2(node.defaultValue)); 14476 DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node ) => new DefaultFormalParameter.full(clone2(node.parameter), node.kind, node.sep arator, clone2(node.defaultValue));
14377 DoStatement visitDoStatement(DoStatement node) => new DoStatement.full(node.do Keyword, clone2(node.body), node.whileKeyword, node.leftParenthesis, clone2(node .condition), node.rightParenthesis, node.semicolon); 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);
14378 DoubleLiteral visitDoubleLiteral(DoubleLiteral node) => new DoubleLiteral.full (node.literal, node.value); 14478 DoubleLiteral visitDoubleLiteral(DoubleLiteral node) => new DoubleLiteral.full (node.literal, node.value);
14379 EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) => new EmptyF unctionBody.full(node.semicolon); 14479 EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) => new EmptyF unctionBody.full(node.semicolon);
14380 EmptyStatement visitEmptyStatement(EmptyStatement node) => new EmptyStatement. full(node.semicolon); 14480 EmptyStatement visitEmptyStatement(EmptyStatement node) => new EmptyStatement. full(node.semicolon);
14381 ExportDirective visitExportDirective(ExportDirective node) => new ExportDirect ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.uri), clone3(node.combinators), node.semicolon); 14481 ExportDirective visitExportDirective(ExportDirective node) => new ExportDirect ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.uri), clone3(node.combinators), node.semicolon);
14382 ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node ) => new ExpressionFunctionBody.full(node.functionDefinition, clone2(node.expres sion), node.semicolon); 14482 ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node ) => new ExpressionFunctionBody.full(node.functionDefinition, clone2(node.expres sion), node.semicolon);
14383 ExpressionStatement visitExpressionStatement(ExpressionStatement node) => new ExpressionStatement.full(clone2(node.expression), node.semicolon); 14483 ExpressionStatement visitExpressionStatement(ExpressionStatement node) => new ExpressionStatement.full(clone2(node.expression), node.semicolon);
14384 ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause.full (node.keyword, clone2(node.superclass)); 14484 ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause.full (node.keyword, clone2(node.superclass));
14385 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDecl aration.full(clone2(node.documentationComment), clone3(node.metadata), node.stat icKeyword, clone2(node.fields), node.semicolon); 14485 FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDecl aration.full(clone2(node.documentationComment), clone3(node.metadata), node.stat icKeyword, clone2(node.fields), node.semicolon);
14386 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => n ew FieldFormalParameter.full(clone2(node.documentationComment), clone3(node.meta data), node.keyword, clone2(node.type), node.thisToken, node.period, clone2(node .identifier), clone2(node.parameters)); 14486 FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => n ew FieldFormalParameter.full(clone2(node.documentationComment), clone3(node.meta data), node.keyword, clone2(node.type), node.thisToken, node.period, clone2(node .identifier), clone2(node.parameters));
14387 ForEachStatement visitForEachStatement(ForEachStatement node) => new ForEachSt atement.full(node.forKeyword, node.leftParenthesis, clone2(node.loopVariable), n ode.inKeyword, clone2(node.iterator), node.rightParenthesis, clone2(node.body)); 14487 ForEachStatement visitForEachStatement(ForEachStatement node) {
14488 DeclaredIdentifier loopVariable = node.loopVariable;
14489 if (loopVariable == null) {
14490 return new ForEachStatement.con2_full(node.forKeyword, node.leftParenthesi s, clone2(node.identifier), node.inKeyword, clone2(node.iterator), node.rightPar enthesis, clone2(node.body));
14491 }
14492 return new ForEachStatement.con1_full(node.forKeyword, node.leftParenthesis, clone2(loopVariable), node.inKeyword, clone2(node.iterator), node.rightParenthe sis, clone2(node.body));
14493 }
14388 FormalParameterList visitFormalParameterList(FormalParameterList node) => new FormalParameterList.full(node.leftParenthesis, clone3(node.parameters), node.lef tDelimiter, node.rightDelimiter, node.rightParenthesis); 14494 FormalParameterList visitFormalParameterList(FormalParameterList node) => new FormalParameterList.full(node.leftParenthesis, clone3(node.parameters), node.lef tDelimiter, node.rightDelimiter, node.rightParenthesis);
14389 ForStatement visitForStatement(ForStatement node) => new ForStatement.full(nod e.forKeyword, node.leftParenthesis, clone2(node.variables), clone2(node.initiali zation), node.leftSeparator, clone2(node.condition), node.rightSeparator, clone3 (node.updaters), node.rightParenthesis, clone2(node.body)); 14495 ForStatement visitForStatement(ForStatement node) => new ForStatement.full(nod e.forKeyword, node.leftParenthesis, clone2(node.variables), clone2(node.initiali zation), node.leftSeparator, clone2(node.condition), node.rightSeparator, clone3 (node.updaters), node.rightParenthesis, clone2(node.body));
14390 FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) => new FunctionDeclaration.full(clone2(node.documentationComment), clone3(node.metadata ), node.externalKeyword, clone2(node.returnType), node.propertyKeyword, clone2(n ode.name), clone2(node.functionExpression)); 14496 FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) => new FunctionDeclaration.full(clone2(node.documentationComment), clone3(node.metadata ), node.externalKeyword, clone2(node.returnType), node.propertyKeyword, clone2(n ode.name), clone2(node.functionExpression));
14391 FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclara tionStatement node) => new FunctionDeclarationStatement.full(clone2(node.functio nDeclaration)); 14497 FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclara tionStatement node) => new FunctionDeclarationStatement.full(clone2(node.functio nDeclaration));
14392 FunctionExpression visitFunctionExpression(FunctionExpression node) => new Fun ctionExpression.full(clone2(node.parameters), clone2(node.body)); 14498 FunctionExpression visitFunctionExpression(FunctionExpression node) => new Fun ctionExpression.full(clone2(node.parameters), clone2(node.body));
14393 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio n), clone2(node.argumentList)); 14499 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio n), clone2(node.argumentList));
14394 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node. keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters) , clone2(node.parameters), node.semicolon); 14500 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node. keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters) , clone2(node.parameters), node.semicolon);
14395 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden tifier), clone2(node.parameters)); 14501 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden tifier), clone2(node.parameters));
14396 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator. full(node.keyword, clone3(node.hiddenNames)); 14502 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator. full(node.keyword, clone3(node.hiddenNames));
14397 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement)); 14503 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
14505 addParameters(node.parameters.parameters); 14611 addParameters(node.parameters.parameters);
14506 } 14612 }
14507 declaration = node; 14613 declaration = node;
14508 return null; 14614 return null;
14509 } 14615 }
14510 Object visitFieldDeclaration(FieldDeclaration node) { 14616 Object visitFieldDeclaration(FieldDeclaration node) {
14511 declaration = node; 14617 declaration = node;
14512 return null; 14618 return null;
14513 } 14619 }
14514 Object visitForEachStatement(ForEachStatement node) { 14620 Object visitForEachStatement(ForEachStatement node) {
14515 addToScope(node.loopVariable.identifier); 14621 DeclaredIdentifier loopVariable = node.loopVariable;
14622 if (loopVariable != null) {
14623 addToScope(loopVariable.identifier);
14624 }
14516 return super.visitForEachStatement(node); 14625 return super.visitForEachStatement(node);
14517 } 14626 }
14518 Object visitForStatement(ForStatement node) { 14627 Object visitForStatement(ForStatement node) {
14519 if (_immediateChild != node.variables && node.variables != null) { 14628 if (_immediateChild != node.variables && node.variables != null) {
14520 addVariables(node.variables.variables); 14629 addVariables(node.variables.variables);
14521 } 14630 }
14522 return super.visitForStatement(node); 14631 return super.visitForStatement(node);
14523 } 14632 }
14524 Object visitFunctionDeclaration(FunctionDeclaration node) { 14633 Object visitFunctionDeclaration(FunctionDeclaration node) {
14525 if (node.parent is! FunctionDeclarationStatement) { 14634 if (node.parent is! FunctionDeclarationStatement) {
14526 declaration = node; 14635 declaration = node;
14527 return null; 14636 return null;
14528 } 14637 }
14529 return super.visitFunctionDeclaration(node); 14638 return super.visitFunctionDeclaration(node);
14530 } 14639 }
14531 Object visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { 14640 Object visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
14532 _referenceIsWithinLocalFunction = true; 14641 _referenceIsWithinLocalFunction = true;
14533 return super.visitFunctionDeclarationStatement(node); 14642 return super.visitFunctionDeclarationStatement(node);
14534 } 14643 }
14535 Object visitFunctionExpression(FunctionExpression node) { 14644 Object visitFunctionExpression(FunctionExpression node) {
14536 if (node.parameters != null && _immediateChild != node.parameters) { 14645 if (node.parameters != null && _immediateChild != node.parameters) {
14537 addParameters(node.parameters.parameters); 14646 addParameters(node.parameters.parameters);
14538 } 14647 }
14539 return super.visitFunctionExpression(node); 14648 return super.visitFunctionExpression(node);
14540 } 14649 }
14541 Object visitMethodDeclaration(MethodDeclaration node) { 14650 Object visitMethodDeclaration(MethodDeclaration node) {
14651 declaration = node;
14542 if (node.parameters == null) { 14652 if (node.parameters == null) {
14543 return null; 14653 return null;
14544 } 14654 }
14545 if (_immediateChild != node.parameters) { 14655 if (_immediateChild != node.parameters) {
14546 addParameters(node.parameters.parameters); 14656 addParameters(node.parameters.parameters);
14547 } 14657 }
14548 declaration = node;
14549 return null; 14658 return null;
14550 } 14659 }
14551 Object visitNode(ASTNode node) { 14660 Object visitNode(ASTNode node) {
14552 _immediateChild = node; 14661 _immediateChild = node;
14553 ASTNode parent = node.parent; 14662 ASTNode parent = node.parent;
14554 if (parent != null) { 14663 if (parent != null) {
14555 parent.accept(this); 14664 parent.accept(this);
14556 } 14665 }
14557 return null; 14666 return null;
14558 } 14667 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
14671 return elements[elements.length - 1].endToken; 14780 return elements[elements.length - 1].endToken;
14672 } 14781 }
14673 /** 14782 /**
14674 * Return the node that is the parent of each of the elements in the list. 14783 * Return the node that is the parent of each of the elements in the list.
14675 * @return the node that is the parent of each of the elements in the list 14784 * @return the node that is the parent of each of the elements in the list
14676 */ 14785 */
14677 ASTNode getOwner() { 14786 ASTNode getOwner() {
14678 return owner; 14787 return owner;
14679 } 14788 }
14680 } 14789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698