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

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

Issue 2622303006: Reapply "Add support for generic function type syntax, part 1" (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Defines the AST model. The AST (Abstract Syntax Tree) model describes the 6 * Defines the AST model. The AST (Abstract Syntax Tree) model describes the
7 * syntactic (as opposed to semantic) structure of Dart code. The semantic 7 * syntactic (as opposed to semantic) structure of Dart code. The semantic
8 * structure of the code is modeled by the 8 * structure of the code is modeled by the
9 * [element model](../element/element.dart). 9 * [element model](../element/element.dart).
10 * 10 *
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 /** 247 /**
248 * Set the right parenthesis to the given [token]. 248 * Set the right parenthesis to the given [token].
249 */ 249 */
250 void set rightParenthesis(Token token); 250 void set rightParenthesis(Token token);
251 } 251 }
252 252
253 /** 253 /**
254 * An as expression. 254 * An as expression.
255 * 255 *
256 * asExpression ::= 256 * asExpression ::=
257 * [Expression] 'as' [TypeName] 257 * [Expression] 'as' [TypeAnnotation]
258 * 258 *
259 * Clients may not extend, implement or mix-in this class. 259 * Clients may not extend, implement or mix-in this class.
260 */ 260 */
261 abstract class AsExpression extends Expression { 261 abstract class AsExpression extends Expression {
262 /** 262 /**
263 * Return the 'as' operator. 263 * Return the 'as' operator.
264 */ 264 */
265 Token get asOperator; 265 Token get asOperator;
266 266
267 /** 267 /**
268 * Set the 'as' operator to the given [token]. 268 * Set the 'as' operator to the given [token].
269 */ 269 */
270 void set asOperator(Token token); 270 void set asOperator(Token token);
271 271
272 /** 272 /**
273 * Return the expression used to compute the value being cast. 273 * Return the expression used to compute the value being cast.
274 */ 274 */
275 Expression get expression; 275 Expression get expression;
276 276
277 /** 277 /**
278 * Set the expression used to compute the value being cast to the given 278 * Set the expression used to compute the value being cast to the given
279 * [expression]. 279 * [expression].
280 */ 280 */
281 void set expression(Expression expression); 281 void set expression(Expression expression);
282 282
283 /** 283 /**
284 * Return the name of the type being cast to. 284 * Return the type being cast to.
285 */ 285 */
286 TypeName get type; 286 TypeAnnotation get type;
287 287
288 /** 288 /**
289 * Set the name of the type being cast to to the given [name]. 289 * Set the type being cast to to the given [type].
290 */ 290 */
291 void set type(TypeName name); 291 void set type(TypeAnnotation type);
292 } 292 }
293 293
294 /** 294 /**
295 * An assert in the initializer list of a constructor. 295 * An assert in the initializer list of a constructor.
296 * 296 *
297 * assertInitializer ::= 297 * assertInitializer ::=
298 * 'assert' '(' [Expression] (',' [Expression])? ')' 298 * 'assert' '(' [Expression] (',' [Expression])? ')'
299 * 299 *
300 * Clients may not extend, implement or mix-in this class. 300 * Clients may not extend, implement or mix-in this class.
301 */ 301 */
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node); 659 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node);
660 660
661 R visitFunctionExpression(FunctionExpression node); 661 R visitFunctionExpression(FunctionExpression node);
662 662
663 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node); 663 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node);
664 664
665 R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias); 665 R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias);
666 666
667 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node); 667 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node);
668 668
669 R visitGenericFunctionType(GenericFunctionType node);
670
671 R visitGenericTypeAlias(GenericTypeAlias node);
672
669 R visitHideCombinator(HideCombinator node); 673 R visitHideCombinator(HideCombinator node);
670 674
671 R visitIfStatement(IfStatement node); 675 R visitIfStatement(IfStatement node);
672 676
673 R visitImplementsClause(ImplementsClause node); 677 R visitImplementsClause(ImplementsClause node);
674 678
675 R visitImportDirective(ImportDirective node); 679 R visitImportDirective(ImportDirective node);
676 680
677 R visitIndexExpression(IndexExpression node); 681 R visitIndexExpression(IndexExpression node);
678 682
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 /** 1101 /**
1098 * Set the parameter whose value will be the exception that was thrown to the 1102 * Set the parameter whose value will be the exception that was thrown to the
1099 * given [parameter]. 1103 * given [parameter].
1100 */ 1104 */
1101 void set exceptionParameter(SimpleIdentifier parameter); 1105 void set exceptionParameter(SimpleIdentifier parameter);
1102 1106
1103 /** 1107 /**
1104 * Return the type of exceptions caught by this catch clause, or `null` if 1108 * Return the type of exceptions caught by this catch clause, or `null` if
1105 * this catch clause catches every type of exception. 1109 * this catch clause catches every type of exception.
1106 */ 1110 */
1107 TypeName get exceptionType; 1111 TypeAnnotation get exceptionType;
1108 1112
1109 /** 1113 /**
1110 * Set the type of exceptions caught by this catch clause to the given 1114 * Set the type of exceptions caught by this catch clause to the given
1111 * [exceptionType]. 1115 * [exceptionType].
1112 */ 1116 */
1113 void set exceptionType(TypeName exceptionType); 1117 void set exceptionType(TypeAnnotation exceptionType);
1114 1118
1115 /** 1119 /**
1116 * Return the left parenthesis, or `null` if there is no 'catch' keyword. 1120 * Return the left parenthesis, or `null` if there is no 'catch' keyword.
1117 */ 1121 */
1118 Token get leftParenthesis; 1122 Token get leftParenthesis;
1119 1123
1120 /** 1124 /**
1121 * Set the left parenthesis to the given [token]. 1125 * Set the left parenthesis to the given [token].
1122 */ 1126 */
1123 void set leftParenthesis(Token token); 1127 void set leftParenthesis(Token token);
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 /** 2191 /**
2188 * Set the token representing either the 'final', 'const' or 'var' keyword to 2192 * Set the token representing either the 'final', 'const' or 'var' keyword to
2189 * the given [token]. 2193 * the given [token].
2190 */ 2194 */
2191 void set keyword(Token token); 2195 void set keyword(Token token);
2192 2196
2193 /** 2197 /**
2194 * Return the name of the declared type of the parameter, or `null` if the 2198 * Return the name of the declared type of the parameter, or `null` if the
2195 * parameter does not have a declared type. 2199 * parameter does not have a declared type.
2196 */ 2200 */
2197 TypeName get type; 2201 TypeAnnotation get type;
2198 2202
2199 /** 2203 /**
2200 * Set the name of the declared type of the parameter to the given [typeName]. 2204 * Set the declared type of the parameter to the given [type].
2201 */ 2205 */
2202 void set type(TypeName typeName); 2206 void set type(TypeAnnotation type);
2203 } 2207 }
2204 2208
2205 /** 2209 /**
2206 * A formal parameter with a default value. There are two kinds of parameters 2210 * A formal parameter with a default value. There are two kinds of parameters
2207 * that are both represented by this class: named formal parameters and 2211 * that are both represented by this class: named formal parameters and
2208 * positional formal parameters. 2212 * positional formal parameters.
2209 * 2213 *
2210 * defaultFormalParameter ::= 2214 * defaultFormalParameter ::=
2211 * [NormalFormalParameter] ('=' [Expression])? 2215 * [NormalFormalParameter] ('=' [Expression])?
2212 * 2216 *
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 /** 2793 /**
2790 * Set the token representing the 'static' keyword to the given [token]. 2794 * Set the token representing the 'static' keyword to the given [token].
2791 */ 2795 */
2792 void set staticKeyword(Token token); 2796 void set staticKeyword(Token token);
2793 } 2797 }
2794 2798
2795 /** 2799 /**
2796 * A field formal parameter. 2800 * A field formal parameter.
2797 * 2801 *
2798 * fieldFormalParameter ::= 2802 * fieldFormalParameter ::=
2799 * ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? 2803 * ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | [TypeAn notation])?
2800 * 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLi st])? 2804 * 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLi st])?
2801 * 2805 *
2802 * Clients may not extend, implement or mix-in this class. 2806 * Clients may not extend, implement or mix-in this class.
2803 */ 2807 */
2804 abstract class FieldFormalParameter extends NormalFormalParameter { 2808 abstract class FieldFormalParameter extends NormalFormalParameter {
2805 /** 2809 /**
2806 * Return the token representing either the 'final', 'const' or 'var' keyword, 2810 * Return the token representing either the 'final', 'const' or 'var' keyword,
2807 * or `null` if no keyword was used. 2811 * or `null` if no keyword was used.
2808 */ 2812 */
2809 Token get keyword; 2813 Token get keyword;
(...skipping 30 matching lines...) Expand all
2840 * Return the token representing the 'this' keyword. 2844 * Return the token representing the 'this' keyword.
2841 */ 2845 */
2842 Token get thisKeyword; 2846 Token get thisKeyword;
2843 2847
2844 /** 2848 /**
2845 * Set the token representing the 'this' keyword to the given [token]. 2849 * Set the token representing the 'this' keyword to the given [token].
2846 */ 2850 */
2847 void set thisKeyword(Token token); 2851 void set thisKeyword(Token token);
2848 2852
2849 /** 2853 /**
2850 * Return the name of the declared type of the parameter, or `null` if the 2854 * Return the declared type of the parameter, or `null` if the parameter does
2851 * parameter does not have a declared type. Note that if this is a 2855 * not have a declared type. Note that if this is a function-typed field
2852 * function-typed field formal parameter this is the return type of the 2856 * formal parameter this is the return type of the function.
2853 * function.
2854 */ 2857 */
2855 TypeName get type; 2858 TypeAnnotation get type;
2856 2859
2857 /** 2860 /**
2858 * Set the name of the declared type of the parameter to the given [typeName]. 2861 * Set the declared type of the parameter to the given [type].
2859 */ 2862 */
2860 void set type(TypeName typeName); 2863 void set type(TypeAnnotation type);
2861 2864
2862 /** 2865 /**
2863 * Return the type parameters associated with this method, or `null` if this 2866 * Return the type parameters associated with this method, or `null` if this
2864 * method is not a generic method. 2867 * method is not a generic method.
2865 */ 2868 */
2866 TypeParameterList get typeParameters; 2869 TypeParameterList get typeParameters;
2867 2870
2868 /** 2871 /**
2869 * Set the type parameters associated with this method to the given 2872 * Set the type parameters associated with this method to the given
2870 * [typeParameters]. 2873 * [typeParameters].
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 3351
3349 /** 3352 /**
3350 * Set the token representing the 'get' or 'set' keyword to the given [token]. 3353 * Set the token representing the 'get' or 'set' keyword to the given [token].
3351 */ 3354 */
3352 void set propertyKeyword(Token token); 3355 void set propertyKeyword(Token token);
3353 3356
3354 /** 3357 /**
3355 * Return the return type of the function, or `null` if no return type was 3358 * Return the return type of the function, or `null` if no return type was
3356 * declared. 3359 * declared.
3357 */ 3360 */
3358 TypeName get returnType; 3361 TypeAnnotation get returnType;
3359 3362
3360 /** 3363 /**
3361 * Set the return type of the function to the given [returnType]. 3364 * Set the return type of the function to the given [type].
3362 */ 3365 */
3363 void set returnType(TypeName returnType); 3366 void set returnType(TypeAnnotation type);
3364 } 3367 }
3365 3368
3366 /** 3369 /**
3367 * A [FunctionDeclaration] used as a statement. 3370 * A [FunctionDeclaration] used as a statement.
3368 * 3371 *
3369 * Clients may not extend, implement or mix-in this class. 3372 * Clients may not extend, implement or mix-in this class.
3370 */ 3373 */
3371 abstract class FunctionDeclarationStatement extends Statement { 3374 abstract class FunctionDeclarationStatement extends Statement {
3372 /** 3375 /**
3373 * Return the function declaration being wrapped. 3376 * Return the function declaration being wrapped.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 void set typeArguments(TypeArgumentList typeArguments); 3509 void set typeArguments(TypeArgumentList typeArguments);
3507 } 3510 }
3508 3511
3509 /** 3512 /**
3510 * A function type alias. 3513 * A function type alias.
3511 * 3514 *
3512 * functionTypeAlias ::= 3515 * functionTypeAlias ::=
3513 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' 3516 * functionPrefix [TypeParameterList]? [FormalParameterList] ';'
3514 * 3517 *
3515 * functionPrefix ::= 3518 * functionPrefix ::=
3516 * [TypeName]? [SimpleIdentifier] 3519 * [TypeAnnotation]? [SimpleIdentifier]
3517 * 3520 *
3518 * Clients may not extend, implement or mix-in this class. 3521 * Clients may not extend, implement or mix-in this class.
3519 */ 3522 */
3520 abstract class FunctionTypeAlias extends TypeAlias { 3523 abstract class FunctionTypeAlias extends TypeAlias {
3521 /** 3524 /**
3522 * Return the parameters associated with the function type. 3525 * Return the parameters associated with the function type.
3523 */ 3526 */
3524 FormalParameterList get parameters; 3527 FormalParameterList get parameters;
3525 3528
3526 /** 3529 /**
3527 * Set the parameters associated with the function type to the given list of 3530 * Set the parameters associated with the function type to the given list of
3528 * [parameters]. 3531 * [parameters].
3529 */ 3532 */
3530 void set parameters(FormalParameterList parameters); 3533 void set parameters(FormalParameterList parameters);
3531 3534
3532 /** 3535 /**
3533 * Return the name of the return type of the function type being defined, or 3536 * Return the return type of the function type being defined, or `null` if no
3534 * `null` if no return type was given. 3537 * return type was given.
3535 */ 3538 */
3536 TypeName get returnType; 3539 TypeAnnotation get returnType;
3537 3540
3538 /** 3541 /**
3539 * Set the name of the return type of the function type being defined to the 3542 * Set the return type of the function type being defined to the given [type].
3540 * given [typeName].
3541 */ 3543 */
3542 void set returnType(TypeName typeName); 3544 void set returnType(TypeAnnotation type);
3543 3545
3544 /** 3546 /**
3545 * Return the type parameters for the function type, or `null` if the function 3547 * Return the type parameters for the function type, or `null` if the function
3546 * type does not have any type parameters. 3548 * type does not have any type parameters.
3547 */ 3549 */
3548 TypeParameterList get typeParameters; 3550 TypeParameterList get typeParameters;
3549 3551
3550 /** 3552 /**
3551 * Set the type parameters for the function type to the given list of 3553 * Set the type parameters for the function type to the given list of
3552 * [typeParameters]. 3554 * [typeParameters].
3553 */ 3555 */
3554 void set typeParameters(TypeParameterList typeParameters); 3556 void set typeParameters(TypeParameterList typeParameters);
3555 } 3557 }
3556 3558
3557 /** 3559 /**
3558 * A function-typed formal parameter. 3560 * A function-typed formal parameter.
3559 * 3561 *
3560 * functionSignature ::= 3562 * functionSignature ::=
3561 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st] 3563 * [TypeAnnotation]? [SimpleIdentifier] [TypeParameterList]? [FormalParam eterList]
3562 * 3564 *
3563 * Clients may not extend, implement or mix-in this class. 3565 * Clients may not extend, implement or mix-in this class.
3564 */ 3566 */
3565 abstract class FunctionTypedFormalParameter extends NormalFormalParameter { 3567 abstract class FunctionTypedFormalParameter extends NormalFormalParameter {
3566 /** 3568 /**
3567 * Return the parameters of the function-typed parameter. 3569 * Return the parameters of the function-typed parameter.
3568 */ 3570 */
3569 FormalParameterList get parameters; 3571 FormalParameterList get parameters;
3570 3572
3571 /** 3573 /**
(...skipping 11 matching lines...) Expand all
3583 /** 3585 /**
3584 * Return the question mark marking this as a nullable type to the given 3586 * Return the question mark marking this as a nullable type to the given
3585 * [question]. 3587 * [question].
3586 */ 3588 */
3587 void set question(Token question); 3589 void set question(Token question);
3588 3590
3589 /** 3591 /**
3590 * Return the return type of the function, or `null` if the function does not 3592 * Return the return type of the function, or `null` if the function does not
3591 * have a return type. 3593 * have a return type.
3592 */ 3594 */
3593 TypeName get returnType; 3595 TypeAnnotation get returnType;
3594 3596
3595 /** 3597 /**
3596 * Set the return type of the function to the given [type]. 3598 * Set the return type of the function to the given [type].
3597 */ 3599 */
3598 void set returnType(TypeName type); 3600 void set returnType(TypeAnnotation type);
3599 3601
3600 /** 3602 /**
3601 * Return the type parameters associated with this function, or `null` if 3603 * Return the type parameters associated with this function, or `null` if
3602 * this function is not a generic function. 3604 * this function is not a generic function.
3603 */ 3605 */
3604 TypeParameterList get typeParameters; 3606 TypeParameterList get typeParameters;
3605 3607
3606 /** 3608 /**
3607 * Set the type parameters associated with this method to the given 3609 * Set the type parameters associated with this method to the given
3608 * [typeParameters]. 3610 * [typeParameters].
3609 */ 3611 */
3610 void set typeParameters(TypeParameterList typeParameters); 3612 void set typeParameters(TypeParameterList typeParameters);
3611 } 3613 }
3612 3614
3613 /** 3615 /**
3616 * An anonymous function type.
3617 *
3618 * functionType ::=
3619 * [TypeAnnotation]? 'Function' [TypeParameterList]? [FormalParameterList ]
3620 *
3621 * where the FormalParameterList is being used to represent the following
3622 * grammar, despite the fact that FormalParameterList can represent a much
3623 * larger grammar than the one below. This is done in order to simplify the
3624 * implementation.
3625 *
3626 * parameterTypeList ::=
3627 * () |
3628 * ( normalParameterTypes ,? ) |
3629 * ( normalParameterTypes , optionalParameterTypes ) |
3630 * ( optionalParameterTypes )
3631 * namedParameterTypes ::=
3632 * { namedParameterType (, namedParameterType)* ,? }
3633 * namedParameterType ::=
3634 * [TypeAnnotation]? [SimpleIdentifier]
3635 * normalParameterTypes ::=
3636 * normalParameterType (, normalParameterType)*
3637 * normalParameterType ::=
3638 * [TypeAnnotation] [SimpleIdentifier]?
3639 * optionalParameterTypes ::=
3640 * optionalPositionalParameterTypes | namedParameterTypes
3641 * optionalPositionalParameterTypes ::=
3642 * [ normalParameterTypes ,? ]
3643 *
3644 * Clients may not extend, implement or mix-in this class.
3645 */
3646 abstract class GenericFunctionType extends TypeAnnotation {
3647 /**
3648 * Return the keyword 'Function'.
3649 */
3650 Token get functionKeyword;
3651
3652 /**
3653 * Set the keyword 'Function' to the given [token].
3654 */
3655 void set functionKeyword(Token token);
3656
3657 /**
3658 * Return the parameters associated with the function type.
3659 */
3660 FormalParameterList get parameters;
3661
3662 /**
3663 * Set the parameters associated with the function type to the given list of
3664 * [parameters].
3665 */
3666 void set parameters(FormalParameterList parameters);
3667
3668 /**
3669 * Return the return type of the function type being defined, or `null` if
3670 * no return type was given.
3671 */
3672 TypeAnnotation get returnType;
3673
3674 /**
3675 * Set the return type of the function type being defined to the given[type].
3676 */
3677 void set returnType(TypeAnnotation type);
3678
3679 /**
3680 * Return the type parameters for the function type, or `null` if the function
3681 * type does not have any type parameters.
3682 */
3683 TypeParameterList get typeParameters;
3684
3685 /**
3686 * Set the type parameters for the function type to the given list of
3687 * [typeParameters].
3688 */
3689 void set typeParameters(TypeParameterList typeParameters);
3690 }
3691
3692 /**
3693 * A generic type alias.
3694 *
3695 * functionTypeAlias ::=
3696 * metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [Function Type] ';'
3697 *
3698 * Clients may not extend, implement or mix-in this class.
3699 */
3700 abstract class GenericTypeAlias extends TypeAlias {
3701 /**
3702 * Return the equal sign separating the name being defined from the function
3703 * type.
3704 */
3705 Token get equals;
3706
3707 /**
3708 * Set the equal sign separating the name being defined from the function ty pe
3709 * to the given [token].
3710 */
3711 void set equals(Token token);
3712
3713 /**
3714 * Return the type of function being defined by the alias.
3715 */
3716 GenericFunctionType get functionType;
3717
3718 /**
3719 * Set the type of function being defined by the alias to the given
3720 * [functionType].
3721 */
3722 void set functionType(GenericFunctionType functionType);
3723
3724 /**
3725 * Return the type parameters for the function type, or `null` if the functi on
3726 * type does not have any type parameters.
3727 */
3728 TypeParameterList get typeParameters;
3729
3730 /**
3731 * Set the type parameters for the function type to the given list of
3732 * [typeParameters].
3733 */
3734 void set typeParameters(TypeParameterList typeParameters);
3735 }
3736
3737 /**
3614 * A combinator that restricts the names being imported to those that are not in 3738 * A combinator that restricts the names being imported to those that are not in
3615 * a given list. 3739 * a given list.
3616 * 3740 *
3617 * hideCombinator ::= 3741 * hideCombinator ::=
3618 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* 3742 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
3619 * 3743 *
3620 * Clients may not extend, implement or mix-in this class. 3744 * Clients may not extend, implement or mix-in this class.
3621 */ 3745 */
3622 abstract class HideCombinator extends Combinator { 3746 abstract class HideCombinator extends Combinator {
3623 /** 3747 /**
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 * Return the type arguments to be applied to the method being invoked, or 4427 * Return the type arguments to be applied to the method being invoked, or
4304 * `null` if no type arguments were provided. 4428 * `null` if no type arguments were provided.
4305 */ 4429 */
4306 TypeArgumentList get typeArguments; 4430 TypeArgumentList get typeArguments;
4307 } 4431 }
4308 4432
4309 /** 4433 /**
4310 * An is expression. 4434 * An is expression.
4311 * 4435 *
4312 * isExpression ::= 4436 * isExpression ::=
4313 * [Expression] 'is' '!'? [TypeName] 4437 * [Expression] 'is' '!'? [TypeAnnotation]
4314 * 4438 *
4315 * Clients may not extend, implement or mix-in this class. 4439 * Clients may not extend, implement or mix-in this class.
4316 */ 4440 */
4317 abstract class IsExpression extends Expression { 4441 abstract class IsExpression extends Expression {
4318 /** 4442 /**
4319 * Return the expression used to compute the value whose type is being tested. 4443 * Return the expression used to compute the value whose type is being tested.
4320 */ 4444 */
4321 Expression get expression; 4445 Expression get expression;
4322 4446
4323 /** 4447 /**
(...skipping 16 matching lines...) Expand all
4340 * Return the not operator, or `null` if the sense of the test is not negated. 4464 * Return the not operator, or `null` if the sense of the test is not negated.
4341 */ 4465 */
4342 Token get notOperator; 4466 Token get notOperator;
4343 4467
4344 /** 4468 /**
4345 * Set the not operator to the given [token]. 4469 * Set the not operator to the given [token].
4346 */ 4470 */
4347 void set notOperator(Token token); 4471 void set notOperator(Token token);
4348 4472
4349 /** 4473 /**
4350 * Return the name of the type being tested for. 4474 * Return the type being tested for.
4351 */ 4475 */
4352 TypeName get type; 4476 TypeAnnotation get type;
4353 4477
4354 /** 4478 /**
4355 * Set the name of the type being tested for to the given [name]. 4479 * Set the type being tested for to the given [type].
4356 */ 4480 */
4357 void set type(TypeName name); 4481 void set type(TypeAnnotation type);
4358 } 4482 }
4359 4483
4360 /** 4484 /**
4361 * A label on either a [LabeledStatement] or a [NamedExpression]. 4485 * A label on either a [LabeledStatement] or a [NamedExpression].
4362 * 4486 *
4363 * label ::= 4487 * label ::=
4364 * [SimpleIdentifier] ':' 4488 * [SimpleIdentifier] ':'
4365 * 4489 *
4366 * Clients may not extend, implement or mix-in this class. 4490 * Clients may not extend, implement or mix-in this class.
4367 */ 4491 */
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 /** 4590 /**
4467 * Return the components of the identifier. 4591 * Return the components of the identifier.
4468 */ 4592 */
4469 NodeList<SimpleIdentifier> get components; 4593 NodeList<SimpleIdentifier> get components;
4470 } 4594 }
4471 4595
4472 /** 4596 /**
4473 * A list literal. 4597 * A list literal.
4474 * 4598 *
4475 * listLiteral ::= 4599 * listLiteral ::=
4476 * 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']' 4600 * 'const'? ('<' [TypeAnnotation] '>')? '[' ([Expression] ','?)? ']'
4477 * 4601 *
4478 * Clients may not extend, implement or mix-in this class. 4602 * Clients may not extend, implement or mix-in this class.
4479 */ 4603 */
4480 abstract class ListLiteral extends TypedLiteral { 4604 abstract class ListLiteral extends TypedLiteral {
4481 /** 4605 /**
4482 * Return the expressions used to compute the elements of the list. 4606 * Return the expressions used to compute the elements of the list.
4483 */ 4607 */
4484 NodeList<Expression> get elements; 4608 NodeList<Expression> get elements;
4485 4609
4486 /** 4610 /**
(...skipping 30 matching lines...) Expand all
4517 * | [StringLiteral] 4641 * | [StringLiteral]
4518 * 4642 *
4519 * Clients may not extend, implement or mix-in this class. 4643 * Clients may not extend, implement or mix-in this class.
4520 */ 4644 */
4521 abstract class Literal extends Expression {} 4645 abstract class Literal extends Expression {}
4522 4646
4523 /** 4647 /**
4524 * A literal map. 4648 * A literal map.
4525 * 4649 *
4526 * mapLiteral ::= 4650 * mapLiteral ::=
4527 * 'const'? ('<' [TypeName] (',' [TypeName])* '>')? 4651 * 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
4528 * '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}' 4652 * '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
4529 * 4653 *
4530 * Clients may not extend, implement or mix-in this class. 4654 * Clients may not extend, implement or mix-in this class.
4531 */ 4655 */
4532 abstract class MapLiteral extends TypedLiteral { 4656 abstract class MapLiteral extends TypedLiteral {
4533 /** 4657 /**
4534 * Return the entries in the map. 4658 * Return the entries in the map.
4535 */ 4659 */
4536 NodeList<MapLiteralEntry> get entries; 4660 NodeList<MapLiteralEntry> get entries;
4537 4661
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4719 4843
4720 /** 4844 /**
4721 * Set the token representing the 'get' or 'set' keyword to the given [token]. 4845 * Set the token representing the 'get' or 'set' keyword to the given [token].
4722 */ 4846 */
4723 void set propertyKeyword(Token token); 4847 void set propertyKeyword(Token token);
4724 4848
4725 /** 4849 /**
4726 * Return the return type of the method, or `null` if no return type was 4850 * Return the return type of the method, or `null` if no return type was
4727 * declared. 4851 * declared.
4728 */ 4852 */
4729 TypeName get returnType; 4853 TypeAnnotation get returnType;
4730 4854
4731 /** 4855 /**
4732 * Set the return type of the method to the given [typeName]. 4856 * Set the return type of the method to the given [type].
4733 */ 4857 */
4734 void set returnType(TypeName typeName); 4858 void set returnType(TypeAnnotation type);
4735 4859
4736 /** 4860 /**
4737 * Return the type parameters associated with this method, or `null` if this 4861 * Return the type parameters associated with this method, or `null` if this
4738 * method is not a generic method. 4862 * method is not a generic method.
4739 */ 4863 */
4740 TypeParameterList get typeParameters; 4864 TypeParameterList get typeParameters;
4741 4865
4742 /** 4866 /**
4743 * Set the type parameters associated with this method to the given 4867 * Set the type parameters associated with this method to the given
4744 * [typeParameters]. 4868 * [typeParameters].
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5636 * Return the list of names from the library that are made visible by this 5760 * Return the list of names from the library that are made visible by this
5637 * combinator. 5761 * combinator.
5638 */ 5762 */
5639 NodeList<SimpleIdentifier> get shownNames; 5763 NodeList<SimpleIdentifier> get shownNames;
5640 } 5764 }
5641 5765
5642 /** 5766 /**
5643 * A simple formal parameter. 5767 * A simple formal parameter.
5644 * 5768 *
5645 * simpleFormalParameter ::= 5769 * simpleFormalParameter ::=
5646 * ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier] 5770 * ('final' [TypeAnnotation] | 'var' | [TypeAnnotation])? [SimpleIdentifi er]
5647 * 5771 *
5648 * Clients may not extend, implement or mix-in this class. 5772 * Clients may not extend, implement or mix-in this class.
5649 */ 5773 */
5650 abstract class SimpleFormalParameter extends NormalFormalParameter { 5774 abstract class SimpleFormalParameter extends NormalFormalParameter {
5651 /** 5775 /**
5652 * Return the token representing either the 'final', 'const' or 'var' keyword, 5776 * Return the token representing either the 'final', 'const' or 'var' keyword,
5653 * or `null` if no keyword was used. 5777 * or `null` if no keyword was used.
5654 */ 5778 */
5655 Token get keyword; 5779 Token get keyword;
5656 5780
5657 /** 5781 /**
5658 * Set the token representing either the 'final', 'const' or 'var' keyword to 5782 * Set the token representing either the 'final', 'const' or 'var' keyword to
5659 * the given [token]. 5783 * the given [token].
5660 */ 5784 */
5661 void set keyword(Token token); 5785 void set keyword(Token token);
5662 5786
5663 /** 5787 /**
5664 * Return the name of the declared type of the parameter, or `null` if the 5788 * Return the declared type of the parameter, or `null` if the parameter does
5665 * parameter does not have a declared type. 5789 * not have a declared type.
5666 */ 5790 */
5667 TypeName get type; 5791 TypeAnnotation get type;
5668 5792
5669 /** 5793 /**
5670 * Set the name of the declared type of the parameter to the given [typeName]. 5794 * Set the declared type of the parameter to the given [type].
5671 */ 5795 */
5672 void set type(TypeName typeName); 5796 void set type(TypeAnnotation type);
5673 } 5797 }
5674 5798
5675 /** 5799 /**
5676 * A simple identifier. 5800 * A simple identifier.
5677 * 5801 *
5678 * simpleIdentifier ::= 5802 * simpleIdentifier ::=
5679 * initialCharacter internalCharacter* 5803 * initialCharacter internalCharacter*
5680 * 5804 *
5681 * initialCharacter ::= '_' | '$' | letter 5805 * initialCharacter ::= '_' | '$' | letter
5682 * 5806 *
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
6329 */ 6453 */
6330 Token get typedefKeyword; 6454 Token get typedefKeyword;
6331 6455
6332 /** 6456 /**
6333 * Set the token representing the 'typedef' keyword to the given [token]. 6457 * Set the token representing the 'typedef' keyword to the given [token].
6334 */ 6458 */
6335 void set typedefKeyword(Token token); 6459 void set typedefKeyword(Token token);
6336 } 6460 }
6337 6461
6338 /** 6462 /**
6463 * A type annotation.
6464 *
6465 * type ::=
6466 * [NamedType]
6467 * | [GenericFunctionType]
6468 *
6469 * Clients may not extend, implement or mix-in this class.
6470 */
6471 abstract class TypeAnnotation extends AstNode {
6472 /**
6473 * Return the type being named, or `null` if the AST structure has not been
6474 * resolved.
6475 */
6476 DartType get type;
6477 }
6478
6479 /**
6339 * A list of type arguments. 6480 * A list of type arguments.
6340 * 6481 *
6341 * typeArguments ::= 6482 * typeArguments ::=
6342 * '<' typeName (',' typeName)* '>' 6483 * '<' typeName (',' typeName)* '>'
6343 * 6484 *
6344 * Clients may not extend, implement or mix-in this class. 6485 * Clients may not extend, implement or mix-in this class.
6345 */ 6486 */
6346 abstract class TypeArgumentList extends AstNode { 6487 abstract class TypeArgumentList extends AstNode {
6347 /** 6488 /**
6348 * Return the type arguments associated with the type. 6489 * Return the type arguments associated with the type.
6349 */ 6490 */
6350 NodeList<TypeName> get arguments; 6491 NodeList<TypeAnnotation> get arguments;
6351 6492
6352 /** 6493 /**
6353 * Return the left bracket. 6494 * Return the left bracket.
6354 */ 6495 */
6355 Token get leftBracket; 6496 Token get leftBracket;
6356 6497
6357 /** 6498 /**
6358 * Set the left bracket to the given [token]. 6499 * Set the left bracket to the given [token].
6359 */ 6500 */
6360 void set leftBracket(Token token); 6501 void set leftBracket(Token token);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6405 } 6546 }
6406 6547
6407 /** 6548 /**
6408 * The name of a type, which can optionally include type arguments. 6549 * The name of a type, which can optionally include type arguments.
6409 * 6550 *
6410 * typeName ::= 6551 * typeName ::=
6411 * [Identifier] typeArguments? 6552 * [Identifier] typeArguments?
6412 * 6553 *
6413 * Clients may not extend, implement or mix-in this class. 6554 * Clients may not extend, implement or mix-in this class.
6414 */ 6555 */
6415 abstract class TypeName extends AstNode { 6556 abstract class TypeName extends TypeAnnotation {
6416 /** 6557 /**
6417 * Return `true` if this type is a deferred type. 6558 * Return `true` if this type is a deferred type.
6418 * 6559 *
6419 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form 6560 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
6420 * </i>p.T</i> where <i>p</i> is a deferred prefix. 6561 * </i>p.T</i> where <i>p</i> is a deferred prefix.
6421 */ 6562 */
6422 bool get isDeferred; 6563 bool get isDeferred;
6423 6564
6424 /** 6565 /**
6425 * Return the name of the type. 6566 * Return the name of the type.
(...skipping 11 matching lines...) Expand all
6437 */ 6578 */
6438 Token get question; 6579 Token get question;
6439 6580
6440 /** 6581 /**
6441 * Return the question mark marking this as a nullable type to the given 6582 * Return the question mark marking this as a nullable type to the given
6442 * [question]. 6583 * [question].
6443 */ 6584 */
6444 void set question(Token question); 6585 void set question(Token question);
6445 6586
6446 /** 6587 /**
6447 * Return the type being named, or `null` if the AST structure has not been
6448 * resolved.
6449 */
6450 DartType get type;
6451
6452 /**
6453 * Set the type being named to the given [type]. 6588 * Set the type being named to the given [type].
6454 */ 6589 */
6455 void set type(DartType type); 6590 void set type(DartType type);
6456 6591
6457 /** 6592 /**
6458 * Return the type arguments associated with the type, or `null` if there are 6593 * Return the type arguments associated with the type, or `null` if there are
6459 * no type arguments. 6594 * no type arguments.
6460 */ 6595 */
6461 TypeArgumentList get typeArguments; 6596 TypeArgumentList get typeArguments;
6462 6597
6463 /** 6598 /**
6464 * Set the type arguments associated with the type to the given 6599 * Set the type arguments associated with the type to the given
6465 * [typeArguments]. 6600 * [typeArguments].
6466 */ 6601 */
6467 void set typeArguments(TypeArgumentList typeArguments); 6602 void set typeArguments(TypeArgumentList typeArguments);
6468 } 6603 }
6469 6604
6470 /** 6605 /**
6471 * A type parameter. 6606 * A type parameter.
6472 * 6607 *
6473 * typeParameter ::= 6608 * typeParameter ::=
6474 * [SimpleIdentifier] ('extends' [TypeName])? 6609 * [SimpleIdentifier] ('extends' [TypeAnnotation])?
6475 * 6610 *
6476 * Clients may not extend, implement or mix-in this class. 6611 * Clients may not extend, implement or mix-in this class.
6477 */ 6612 */
6478 abstract class TypeParameter extends Declaration { 6613 abstract class TypeParameter extends Declaration {
6479 /** 6614 /**
6480 * Return the name of the upper bound for legal arguments, or `null` if there 6615 * Return the upper bound for legal arguments, or `null` if there is no
6481 * is no explicit upper bound. 6616 * explicit upper bound.
6482 */ 6617 */
6483 TypeName get bound; 6618 TypeAnnotation get bound;
6484 6619
6485 /** 6620 /**
6486 * Set the name of the upper bound for legal arguments to the given 6621 * Set the upper bound for legal arguments to the given [type].
6487 * [typeName].
6488 */ 6622 */
6489 void set bound(TypeName typeName); 6623 void set bound(TypeAnnotation type);
6490 6624
6491 /** 6625 /**
6492 * Return the token representing the 'extends' keyword, or `null` if there is 6626 * Return the token representing the 'extends' keyword, or `null` if there is
6493 * no explicit upper bound. 6627 * no explicit upper bound.
6494 */ 6628 */
6495 Token get extendsKeyword; 6629 Token get extendsKeyword;
6496 6630
6497 /** 6631 /**
6498 * Set the token representing the 'extends' keyword to the given [token]. 6632 * Set the token representing the 'extends' keyword to the given [token].
6499 */ 6633 */
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
6662 void set name(SimpleIdentifier identifier); 6796 void set name(SimpleIdentifier identifier);
6663 } 6797 }
6664 6798
6665 /** 6799 /**
6666 * The declaration of one or more variables of the same type. 6800 * The declaration of one or more variables of the same type.
6667 * 6801 *
6668 * variableDeclarationList ::= 6802 * variableDeclarationList ::=
6669 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])* 6803 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
6670 * 6804 *
6671 * finalConstVarOrType ::= 6805 * finalConstVarOrType ::=
6672 * | 'final' [TypeName]? 6806 * | 'final' [TypeAnnotation]?
6673 * | 'const' [TypeName]? 6807 * | 'const' [TypeAnnotation]?
6674 * | 'var' 6808 * | 'var'
6675 * | [TypeName] 6809 * | [TypeAnnotation]
6676 * 6810 *
6677 * Clients may not extend, implement or mix-in this class. 6811 * Clients may not extend, implement or mix-in this class.
6678 */ 6812 */
6679 abstract class VariableDeclarationList extends AnnotatedNode { 6813 abstract class VariableDeclarationList extends AnnotatedNode {
6680 /** 6814 /**
6681 * Return `true` if the variables in this list were declared with the 'const' 6815 * Return `true` if the variables in this list were declared with the 'const'
6682 * modifier. 6816 * modifier.
6683 */ 6817 */
6684 bool get isConst; 6818 bool get isConst;
6685 6819
(...skipping 14 matching lines...) Expand all
6700 /** 6834 /**
6701 * Set the token representing the 'final', 'const' or 'var' keyword to the 6835 * Set the token representing the 'final', 'const' or 'var' keyword to the
6702 * given [token]. 6836 * given [token].
6703 */ 6837 */
6704 void set keyword(Token token); 6838 void set keyword(Token token);
6705 6839
6706 /** 6840 /**
6707 * Return the type of the variables being declared, or `null` if no type was 6841 * Return the type of the variables being declared, or `null` if no type was
6708 * provided. 6842 * provided.
6709 */ 6843 */
6710 TypeName get type; 6844 TypeAnnotation get type;
6711 6845
6712 /** 6846 /**
6713 * Set the type of the variables being declared to the given [typeName]. 6847 * Set the type of the variables being declared to the given [type].
6714 */ 6848 */
6715 void set type(TypeName typeName); 6849 void set type(TypeAnnotation type);
6716 6850
6717 /** 6851 /**
6718 * Return a list containing the individual variables being declared. 6852 * Return a list containing the individual variables being declared.
6719 */ 6853 */
6720 NodeList<VariableDeclaration> get variables; 6854 NodeList<VariableDeclaration> get variables;
6721 } 6855 }
6722 6856
6723 /** 6857 /**
6724 * A list of variables that are being declared in a context where a statement is 6858 * A list of variables that are being declared in a context where a statement is
6725 * required. 6859 * required.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6880 /** 7014 /**
6881 * Return the 'yield' keyword. 7015 * Return the 'yield' keyword.
6882 */ 7016 */
6883 Token get yieldKeyword; 7017 Token get yieldKeyword;
6884 7018
6885 /** 7019 /**
6886 * Return the 'yield' keyword to the given [token]. 7020 * Return the 'yield' keyword to the given [token].
6887 */ 7021 */
6888 void set yieldKeyword(Token token); 7022 void set yieldKeyword(Token token);
6889 } 7023 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698