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

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

Issue 2613383003: 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node); 652 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node);
653 653
654 R visitFunctionExpression(FunctionExpression node); 654 R visitFunctionExpression(FunctionExpression node);
655 655
656 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node); 656 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node);
657 657
658 R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias); 658 R visitFunctionTypeAlias(FunctionTypeAlias functionTypeAlias);
659 659
660 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node); 660 R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node);
661 661
662 R visitGenericFunctionType(GenericFunctionType node);
663
664 R visitGenericTypeAlias(GenericTypeAlias node);
665
662 R visitHideCombinator(HideCombinator node); 666 R visitHideCombinator(HideCombinator node);
663 667
664 R visitIfStatement(IfStatement node); 668 R visitIfStatement(IfStatement node);
665 669
666 R visitImplementsClause(ImplementsClause node); 670 R visitImplementsClause(ImplementsClause node);
667 671
668 R visitImportDirective(ImportDirective node); 672 R visitImportDirective(ImportDirective node);
669 673
670 R visitIndexExpression(IndexExpression node); 674 R visitIndexExpression(IndexExpression node);
671 675
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 /** 1094 /**
1091 * Set the parameter whose value will be the exception that was thrown to the 1095 * Set the parameter whose value will be the exception that was thrown to the
1092 * given [parameter]. 1096 * given [parameter].
1093 */ 1097 */
1094 void set exceptionParameter(SimpleIdentifier parameter); 1098 void set exceptionParameter(SimpleIdentifier parameter);
1095 1099
1096 /** 1100 /**
1097 * Return the type of exceptions caught by this catch clause, or `null` if 1101 * Return the type of exceptions caught by this catch clause, or `null` if
1098 * this catch clause catches every type of exception. 1102 * this catch clause catches every type of exception.
1099 */ 1103 */
1100 TypeName get exceptionType; 1104 TypeAnnotation get exceptionType;
1101 1105
1102 /** 1106 /**
1103 * Set the type of exceptions caught by this catch clause to the given 1107 * Set the type of exceptions caught by this catch clause to the given
1104 * [exceptionType]. 1108 * [exceptionType].
1105 */ 1109 */
1106 void set exceptionType(TypeName exceptionType); 1110 void set exceptionType(TypeAnnotation exceptionType);
1107 1111
1108 /** 1112 /**
1109 * Return the left parenthesis, or `null` if there is no 'catch' keyword. 1113 * Return the left parenthesis, or `null` if there is no 'catch' keyword.
1110 */ 1114 */
1111 Token get leftParenthesis; 1115 Token get leftParenthesis;
1112 1116
1113 /** 1117 /**
1114 * Set the left parenthesis to the given [token]. 1118 * Set the left parenthesis to the given [token].
1115 */ 1119 */
1116 void set leftParenthesis(Token token); 1120 void set leftParenthesis(Token token);
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 /** 2184 /**
2181 * Set the token representing either the 'final', 'const' or 'var' keyword to 2185 * Set the token representing either the 'final', 'const' or 'var' keyword to
2182 * the given [token]. 2186 * the given [token].
2183 */ 2187 */
2184 void set keyword(Token token); 2188 void set keyword(Token token);
2185 2189
2186 /** 2190 /**
2187 * Return the name of the declared type of the parameter, or `null` if the 2191 * Return the name of the declared type of the parameter, or `null` if the
2188 * parameter does not have a declared type. 2192 * parameter does not have a declared type.
2189 */ 2193 */
2190 TypeName get type; 2194 TypeAnnotation get type;
2191 2195
2192 /** 2196 /**
2193 * Set the name of the declared type of the parameter to the given [typeName]. 2197 * Set the declared type of the parameter to the given [type].
2194 */ 2198 */
2195 void set type(TypeName typeName); 2199 void set type(TypeAnnotation type);
2196 } 2200 }
2197 2201
2198 /** 2202 /**
2199 * A formal parameter with a default value. There are two kinds of parameters 2203 * A formal parameter with a default value. There are two kinds of parameters
2200 * that are both represented by this class: named formal parameters and 2204 * that are both represented by this class: named formal parameters and
2201 * positional formal parameters. 2205 * positional formal parameters.
2202 * 2206 *
2203 * defaultFormalParameter ::= 2207 * defaultFormalParameter ::=
2204 * [NormalFormalParameter] ('=' [Expression])? 2208 * [NormalFormalParameter] ('=' [Expression])?
2205 * 2209 *
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 /** 2786 /**
2783 * Set the token representing the 'static' keyword to the given [token]. 2787 * Set the token representing the 'static' keyword to the given [token].
2784 */ 2788 */
2785 void set staticKeyword(Token token); 2789 void set staticKeyword(Token token);
2786 } 2790 }
2787 2791
2788 /** 2792 /**
2789 * A field formal parameter. 2793 * A field formal parameter.
2790 * 2794 *
2791 * fieldFormalParameter ::= 2795 * fieldFormalParameter ::=
2792 * ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])? 2796 * ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | [TypeAn notation])?
2793 * 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLi st])? 2797 * 'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterLi st])?
2794 * 2798 *
2795 * Clients may not extend, implement or mix-in this class. 2799 * Clients may not extend, implement or mix-in this class.
2796 */ 2800 */
2797 abstract class FieldFormalParameter extends NormalFormalParameter { 2801 abstract class FieldFormalParameter extends NormalFormalParameter {
2798 /** 2802 /**
2799 * Return the token representing either the 'final', 'const' or 'var' keyword, 2803 * Return the token representing either the 'final', 'const' or 'var' keyword,
2800 * or `null` if no keyword was used. 2804 * or `null` if no keyword was used.
2801 */ 2805 */
2802 Token get keyword; 2806 Token get keyword;
(...skipping 30 matching lines...) Expand all
2833 * Return the token representing the 'this' keyword. 2837 * Return the token representing the 'this' keyword.
2834 */ 2838 */
2835 Token get thisKeyword; 2839 Token get thisKeyword;
2836 2840
2837 /** 2841 /**
2838 * Set the token representing the 'this' keyword to the given [token]. 2842 * Set the token representing the 'this' keyword to the given [token].
2839 */ 2843 */
2840 void set thisKeyword(Token token); 2844 void set thisKeyword(Token token);
2841 2845
2842 /** 2846 /**
2843 * Return the name of the declared type of the parameter, or `null` if the 2847 * Return the declared type of the parameter, or `null` if the parameter does
2844 * parameter does not have a declared type. Note that if this is a 2848 * not have a declared type. Note that if this is a function-typed field
2845 * function-typed field formal parameter this is the return type of the 2849 * formal parameter this is the return type of the function.
2846 * function.
2847 */ 2850 */
2848 TypeName get type; 2851 TypeAnnotation get type;
2849 2852
2850 /** 2853 /**
2851 * Set the name of the declared type of the parameter to the given [typeName]. 2854 * Set the declared type of the parameter to the given [type].
2852 */ 2855 */
2853 void set type(TypeName typeName); 2856 void set type(TypeAnnotation type);
2854 2857
2855 /** 2858 /**
2856 * Return the type parameters associated with this method, or `null` if this 2859 * Return the type parameters associated with this method, or `null` if this
2857 * method is not a generic method. 2860 * method is not a generic method.
2858 */ 2861 */
2859 TypeParameterList get typeParameters; 2862 TypeParameterList get typeParameters;
2860 2863
2861 /** 2864 /**
2862 * Set the type parameters associated with this method to the given 2865 * Set the type parameters associated with this method to the given
2863 * [typeParameters]. 2866 * [typeParameters].
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 3344
3342 /** 3345 /**
3343 * Set the token representing the 'get' or 'set' keyword to the given [token]. 3346 * Set the token representing the 'get' or 'set' keyword to the given [token].
3344 */ 3347 */
3345 void set propertyKeyword(Token token); 3348 void set propertyKeyword(Token token);
3346 3349
3347 /** 3350 /**
3348 * Return the return type of the function, or `null` if no return type was 3351 * Return the return type of the function, or `null` if no return type was
3349 * declared. 3352 * declared.
3350 */ 3353 */
3351 TypeName get returnType; 3354 TypeAnnotation get returnType;
3352 3355
3353 /** 3356 /**
3354 * Set the return type of the function to the given [returnType]. 3357 * Set the return type of the function to the given [type].
3355 */ 3358 */
3356 void set returnType(TypeName returnType); 3359 void set returnType(TypeAnnotation type);
3357 } 3360 }
3358 3361
3359 /** 3362 /**
3360 * A [FunctionDeclaration] used as a statement. 3363 * A [FunctionDeclaration] used as a statement.
3361 * 3364 *
3362 * Clients may not extend, implement or mix-in this class. 3365 * Clients may not extend, implement or mix-in this class.
3363 */ 3366 */
3364 abstract class FunctionDeclarationStatement extends Statement { 3367 abstract class FunctionDeclarationStatement extends Statement {
3365 /** 3368 /**
3366 * Return the function declaration being wrapped. 3369 * Return the function declaration being wrapped.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3499 void set typeArguments(TypeArgumentList typeArguments); 3502 void set typeArguments(TypeArgumentList typeArguments);
3500 } 3503 }
3501 3504
3502 /** 3505 /**
3503 * A function type alias. 3506 * A function type alias.
3504 * 3507 *
3505 * functionTypeAlias ::= 3508 * functionTypeAlias ::=
3506 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' 3509 * functionPrefix [TypeParameterList]? [FormalParameterList] ';'
3507 * 3510 *
3508 * functionPrefix ::= 3511 * functionPrefix ::=
3509 * [TypeName]? [SimpleIdentifier] 3512 * [TypeAnnotation]? [SimpleIdentifier]
3510 * 3513 *
3511 * Clients may not extend, implement or mix-in this class. 3514 * Clients may not extend, implement or mix-in this class.
3512 */ 3515 */
3513 abstract class FunctionTypeAlias extends TypeAlias { 3516 abstract class FunctionTypeAlias extends TypeAlias {
3514 /** 3517 /**
3515 * Return the parameters associated with the function type. 3518 * Return the parameters associated with the function type.
3516 */ 3519 */
3517 FormalParameterList get parameters; 3520 FormalParameterList get parameters;
3518 3521
3519 /** 3522 /**
3520 * Set the parameters associated with the function type to the given list of 3523 * Set the parameters associated with the function type to the given list of
3521 * [parameters]. 3524 * [parameters].
3522 */ 3525 */
3523 void set parameters(FormalParameterList parameters); 3526 void set parameters(FormalParameterList parameters);
3524 3527
3525 /** 3528 /**
3526 * Return the name of the return type of the function type being defined, or 3529 * Return the return type of the function type being defined, or `null` if no
3527 * `null` if no return type was given. 3530 * return type was given.
3528 */ 3531 */
3529 TypeName get returnType; 3532 TypeAnnotation get returnType;
3530 3533
3531 /** 3534 /**
3532 * Set the name of the return type of the function type being defined to the 3535 * Set the return type of the function type being defined to the given [type].
3533 * given [typeName].
3534 */ 3536 */
3535 void set returnType(TypeName typeName); 3537 void set returnType(TypeAnnotation type);
3536 3538
3537 /** 3539 /**
3538 * Return the type parameters for the function type, or `null` if the function 3540 * Return the type parameters for the function type, or `null` if the function
3539 * type does not have any type parameters. 3541 * type does not have any type parameters.
3540 */ 3542 */
3541 TypeParameterList get typeParameters; 3543 TypeParameterList get typeParameters;
3542 3544
3543 /** 3545 /**
3544 * Set the type parameters for the function type to the given list of 3546 * Set the type parameters for the function type to the given list of
3545 * [typeParameters]. 3547 * [typeParameters].
3546 */ 3548 */
3547 void set typeParameters(TypeParameterList typeParameters); 3549 void set typeParameters(TypeParameterList typeParameters);
3548 } 3550 }
3549 3551
3550 /** 3552 /**
3551 * A function-typed formal parameter. 3553 * A function-typed formal parameter.
3552 * 3554 *
3553 * functionSignature ::= 3555 * functionSignature ::=
3554 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st] 3556 * [TypeAnnotation]? [SimpleIdentifier] [TypeParameterList]? [FormalParam eterList]
3555 * 3557 *
3556 * Clients may not extend, implement or mix-in this class. 3558 * Clients may not extend, implement or mix-in this class.
3557 */ 3559 */
3558 abstract class FunctionTypedFormalParameter extends NormalFormalParameter { 3560 abstract class FunctionTypedFormalParameter extends NormalFormalParameter {
3559 /** 3561 /**
3560 * Return the parameters of the function-typed parameter. 3562 * Return the parameters of the function-typed parameter.
3561 */ 3563 */
3562 FormalParameterList get parameters; 3564 FormalParameterList get parameters;
3563 3565
3564 /** 3566 /**
(...skipping 11 matching lines...) Expand all
3576 /** 3578 /**
3577 * Return the question mark marking this as a nullable type to the given 3579 * Return the question mark marking this as a nullable type to the given
3578 * [question]. 3580 * [question].
3579 */ 3581 */
3580 void set question(Token question); 3582 void set question(Token question);
3581 3583
3582 /** 3584 /**
3583 * Return the return type of the function, or `null` if the function does not 3585 * Return the return type of the function, or `null` if the function does not
3584 * have a return type. 3586 * have a return type.
3585 */ 3587 */
3586 TypeName get returnType; 3588 TypeAnnotation get returnType;
3587 3589
3588 /** 3590 /**
3589 * Set the return type of the function to the given [type]. 3591 * Set the return type of the function to the given [type].
3590 */ 3592 */
3591 void set returnType(TypeName type); 3593 void set returnType(TypeAnnotation type);
3592 3594
3593 /** 3595 /**
3594 * Return the type parameters associated with this function, or `null` if 3596 * Return the type parameters associated with this function, or `null` if
3595 * this function is not a generic function. 3597 * this function is not a generic function.
3596 */ 3598 */
3597 TypeParameterList get typeParameters; 3599 TypeParameterList get typeParameters;
3598 3600
3599 /** 3601 /**
3600 * Set the type parameters associated with this method to the given 3602 * Set the type parameters associated with this method to the given
3601 * [typeParameters]. 3603 * [typeParameters].
3602 */ 3604 */
3603 void set typeParameters(TypeParameterList typeParameters); 3605 void set typeParameters(TypeParameterList typeParameters);
3604 } 3606 }
3605 3607
3606 /** 3608 /**
3609 * An anonymous function type.
3610 *
3611 * functionType ::=
3612 * [TypeAnnotation]? 'Function' [TypeParameterList]? [FormalParameterList ]
3613 *
3614 * where the FormalParameterList is being used to represent the following
3615 * grammar, despite the fact that FormalParameterList can represent a much
3616 * larger grammar than the one below. This is done in order to simplify the
3617 * implementation.
3618 *
3619 * parameterTypeList ::=
3620 * () |
3621 * ( normalParameterTypes ,? ) |
3622 * ( normalParameterTypes , optionalParameterTypes ) |
3623 * ( optionalParameterTypes )
3624 * namedParameterTypes ::=
3625 * { namedParameterType (, namedParameterType)* ,? }
3626 * namedParameterType ::=
3627 * [TypeAnnotation]? [SimpleIdentifier]
3628 * normalParameterTypes ::=
3629 * normalParameterType (, normalParameterType)*
3630 * normalParameterType ::=
3631 * [TypeAnnotation] [SimpleIdentifier]?
3632 * optionalParameterTypes ::=
3633 * optionalPositionalParameterTypes | namedParameterTypes
3634 * optionalPositionalParameterTypes ::=
3635 * [ normalParameterTypes ,? ]
3636 *
3637 * Clients may not extend, implement or mix-in this class.
3638 */
3639 abstract class GenericFunctionType extends TypeAnnotation {
3640 /**
3641 * Return the keyword 'Function'.
3642 */
3643 Token get functionKeyword;
3644
3645 /**
3646 * Set the keyword 'Function' to the given [token].
3647 */
3648 void set functionKeyword(Token token);
3649
3650 /**
3651 * Return the parameters associated with the function type.
3652 */
3653 FormalParameterList get parameters;
3654
3655 /**
3656 * Set the parameters associated with the function type to the given list of
3657 * [parameters].
3658 */
3659 void set parameters(FormalParameterList parameters);
3660
3661 /**
3662 * Return the return type of the function type being defined, or `null` if
3663 * no return type was given.
3664 */
3665 TypeAnnotation get returnType;
3666
3667 /**
3668 * Set the return type of the function type being defined to the given[type].
3669 */
3670 void set returnType(TypeAnnotation type);
3671
3672 /**
3673 * Return the type parameters for the function type, or `null` if the function
3674 * type does not have any type parameters.
3675 */
3676 TypeParameterList get typeParameters;
3677
3678 /**
3679 * Set the type parameters for the function type to the given list of
3680 * [typeParameters].
3681 */
3682 void set typeParameters(TypeParameterList typeParameters);
3683 }
3684
3685 /**
3686 * A generic type alias.
3687 *
3688 * functionTypeAlias ::=
3689 * metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [Function Type] ';'
3690 *
3691 * Clients may not extend, implement or mix-in this class.
3692 */
3693 abstract class GenericTypeAlias extends TypeAlias {
3694 /**
3695 * Return the equal sign separating the name being defined from the function
3696 * type.
3697 */
3698 Token get equals;
3699
3700 /**
3701 * Set the equal sign separating the name being defined from the function ty pe
3702 * to the given [token].
3703 */
3704 void set equals(Token token);
3705
3706 /**
3707 * Return the type of function being defined by the alias.
3708 */
3709 GenericFunctionType get functionType;
3710
3711 /**
3712 * Set the type of function being defined by the alias to the given
3713 * [functionType].
3714 */
3715 void set functionType(GenericFunctionType functionType);
3716
3717 /**
3718 * Return the type parameters for the function type, or `null` if the functi on
3719 * type does not have any type parameters.
3720 */
3721 TypeParameterList get typeParameters;
3722
3723 /**
3724 * Set the type parameters for the function type to the given list of
3725 * [typeParameters].
3726 */
3727 void set typeParameters(TypeParameterList typeParameters);
3728 }
3729
3730 /**
3607 * A combinator that restricts the names being imported to those that are not in 3731 * A combinator that restricts the names being imported to those that are not in
3608 * a given list. 3732 * a given list.
3609 * 3733 *
3610 * hideCombinator ::= 3734 * hideCombinator ::=
3611 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* 3735 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
3612 * 3736 *
3613 * Clients may not extend, implement or mix-in this class. 3737 * Clients may not extend, implement or mix-in this class.
3614 */ 3738 */
3615 abstract class HideCombinator extends Combinator { 3739 abstract class HideCombinator extends Combinator {
3616 /** 3740 /**
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
4296 * Return the type arguments to be applied to the method being invoked, or 4420 * Return the type arguments to be applied to the method being invoked, or
4297 * `null` if no type arguments were provided. 4421 * `null` if no type arguments were provided.
4298 */ 4422 */
4299 TypeArgumentList get typeArguments; 4423 TypeArgumentList get typeArguments;
4300 } 4424 }
4301 4425
4302 /** 4426 /**
4303 * An is expression. 4427 * An is expression.
4304 * 4428 *
4305 * isExpression ::= 4429 * isExpression ::=
4306 * [Expression] 'is' '!'? [TypeName] 4430 * [Expression] 'is' '!'? [TypeAnnotation]
4307 * 4431 *
4308 * Clients may not extend, implement or mix-in this class. 4432 * Clients may not extend, implement or mix-in this class.
4309 */ 4433 */
4310 abstract class IsExpression extends Expression { 4434 abstract class IsExpression extends Expression {
4311 /** 4435 /**
4312 * Return the expression used to compute the value whose type is being tested. 4436 * Return the expression used to compute the value whose type is being tested.
4313 */ 4437 */
4314 Expression get expression; 4438 Expression get expression;
4315 4439
4316 /** 4440 /**
(...skipping 16 matching lines...) Expand all
4333 * Return the not operator, or `null` if the sense of the test is not negated. 4457 * Return the not operator, or `null` if the sense of the test is not negated.
4334 */ 4458 */
4335 Token get notOperator; 4459 Token get notOperator;
4336 4460
4337 /** 4461 /**
4338 * Set the not operator to the given [token]. 4462 * Set the not operator to the given [token].
4339 */ 4463 */
4340 void set notOperator(Token token); 4464 void set notOperator(Token token);
4341 4465
4342 /** 4466 /**
4343 * Return the name of the type being tested for. 4467 * Return the type being tested for.
4344 */ 4468 */
4345 TypeName get type; 4469 TypeAnnotation get type;
4346 4470
4347 /** 4471 /**
4348 * Set the name of the type being tested for to the given [name]. 4472 * Set the type being tested for to the given [type].
4349 */ 4473 */
4350 void set type(TypeName name); 4474 void set type(TypeAnnotation type);
4351 } 4475 }
4352 4476
4353 /** 4477 /**
4354 * A label on either a [LabeledStatement] or a [NamedExpression]. 4478 * A label on either a [LabeledStatement] or a [NamedExpression].
4355 * 4479 *
4356 * label ::= 4480 * label ::=
4357 * [SimpleIdentifier] ':' 4481 * [SimpleIdentifier] ':'
4358 * 4482 *
4359 * Clients may not extend, implement or mix-in this class. 4483 * Clients may not extend, implement or mix-in this class.
4360 */ 4484 */
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4459 /** 4583 /**
4460 * Return the components of the identifier. 4584 * Return the components of the identifier.
4461 */ 4585 */
4462 NodeList<SimpleIdentifier> get components; 4586 NodeList<SimpleIdentifier> get components;
4463 } 4587 }
4464 4588
4465 /** 4589 /**
4466 * A list literal. 4590 * A list literal.
4467 * 4591 *
4468 * listLiteral ::= 4592 * listLiteral ::=
4469 * 'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']' 4593 * 'const'? ('<' [TypeAnnotation] '>')? '[' ([Expression] ','?)? ']'
4470 * 4594 *
4471 * Clients may not extend, implement or mix-in this class. 4595 * Clients may not extend, implement or mix-in this class.
4472 */ 4596 */
4473 abstract class ListLiteral extends TypedLiteral { 4597 abstract class ListLiteral extends TypedLiteral {
4474 /** 4598 /**
4475 * Return the expressions used to compute the elements of the list. 4599 * Return the expressions used to compute the elements of the list.
4476 */ 4600 */
4477 NodeList<Expression> get elements; 4601 NodeList<Expression> get elements;
4478 4602
4479 /** 4603 /**
(...skipping 30 matching lines...) Expand all
4510 * | [StringLiteral] 4634 * | [StringLiteral]
4511 * 4635 *
4512 * Clients may not extend, implement or mix-in this class. 4636 * Clients may not extend, implement or mix-in this class.
4513 */ 4637 */
4514 abstract class Literal extends Expression {} 4638 abstract class Literal extends Expression {}
4515 4639
4516 /** 4640 /**
4517 * A literal map. 4641 * A literal map.
4518 * 4642 *
4519 * mapLiteral ::= 4643 * mapLiteral ::=
4520 * 'const'? ('<' [TypeName] (',' [TypeName])* '>')? 4644 * 'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
4521 * '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}' 4645 * '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
4522 * 4646 *
4523 * Clients may not extend, implement or mix-in this class. 4647 * Clients may not extend, implement or mix-in this class.
4524 */ 4648 */
4525 abstract class MapLiteral extends TypedLiteral { 4649 abstract class MapLiteral extends TypedLiteral {
4526 /** 4650 /**
4527 * Return the entries in the map. 4651 * Return the entries in the map.
4528 */ 4652 */
4529 NodeList<MapLiteralEntry> get entries; 4653 NodeList<MapLiteralEntry> get entries;
4530 4654
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4712 4836
4713 /** 4837 /**
4714 * Set the token representing the 'get' or 'set' keyword to the given [token]. 4838 * Set the token representing the 'get' or 'set' keyword to the given [token].
4715 */ 4839 */
4716 void set propertyKeyword(Token token); 4840 void set propertyKeyword(Token token);
4717 4841
4718 /** 4842 /**
4719 * Return the return type of the method, or `null` if no return type was 4843 * Return the return type of the method, or `null` if no return type was
4720 * declared. 4844 * declared.
4721 */ 4845 */
4722 TypeName get returnType; 4846 TypeAnnotation get returnType;
4723 4847
4724 /** 4848 /**
4725 * Set the return type of the method to the given [typeName]. 4849 * Set the return type of the method to the given [type].
4726 */ 4850 */
4727 void set returnType(TypeName typeName); 4851 void set returnType(TypeAnnotation type);
4728 4852
4729 /** 4853 /**
4730 * Return the type parameters associated with this method, or `null` if this 4854 * Return the type parameters associated with this method, or `null` if this
4731 * method is not a generic method. 4855 * method is not a generic method.
4732 */ 4856 */
4733 TypeParameterList get typeParameters; 4857 TypeParameterList get typeParameters;
4734 4858
4735 /** 4859 /**
4736 * Set the type parameters associated with this method to the given 4860 * Set the type parameters associated with this method to the given
4737 * [typeParameters]. 4861 * [typeParameters].
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5629 * Return the list of names from the library that are made visible by this 5753 * Return the list of names from the library that are made visible by this
5630 * combinator. 5754 * combinator.
5631 */ 5755 */
5632 NodeList<SimpleIdentifier> get shownNames; 5756 NodeList<SimpleIdentifier> get shownNames;
5633 } 5757 }
5634 5758
5635 /** 5759 /**
5636 * A simple formal parameter. 5760 * A simple formal parameter.
5637 * 5761 *
5638 * simpleFormalParameter ::= 5762 * simpleFormalParameter ::=
5639 * ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier] 5763 * ('final' [TypeAnnotation] | 'var' | [TypeAnnotation])? [SimpleIdentifi er]
5640 * 5764 *
5641 * Clients may not extend, implement or mix-in this class. 5765 * Clients may not extend, implement or mix-in this class.
5642 */ 5766 */
5643 abstract class SimpleFormalParameter extends NormalFormalParameter { 5767 abstract class SimpleFormalParameter extends NormalFormalParameter {
5644 /** 5768 /**
5645 * Return the token representing either the 'final', 'const' or 'var' keyword, 5769 * Return the token representing either the 'final', 'const' or 'var' keyword,
5646 * or `null` if no keyword was used. 5770 * or `null` if no keyword was used.
5647 */ 5771 */
5648 Token get keyword; 5772 Token get keyword;
5649 5773
5650 /** 5774 /**
5651 * Set the token representing either the 'final', 'const' or 'var' keyword to 5775 * Set the token representing either the 'final', 'const' or 'var' keyword to
5652 * the given [token]. 5776 * the given [token].
5653 */ 5777 */
5654 void set keyword(Token token); 5778 void set keyword(Token token);
5655 5779
5656 /** 5780 /**
5657 * Return the name of the declared type of the parameter, or `null` if the 5781 * Return the declared type of the parameter, or `null` if the parameter does
5658 * parameter does not have a declared type. 5782 * not have a declared type.
5659 */ 5783 */
5660 TypeName get type; 5784 TypeAnnotation get type;
5661 5785
5662 /** 5786 /**
5663 * Set the name of the declared type of the parameter to the given [typeName]. 5787 * Set the declared type of the parameter to the given [type].
5664 */ 5788 */
5665 void set type(TypeName typeName); 5789 void set type(TypeAnnotation type);
5666 } 5790 }
5667 5791
5668 /** 5792 /**
5669 * A simple identifier. 5793 * A simple identifier.
5670 * 5794 *
5671 * simpleIdentifier ::= 5795 * simpleIdentifier ::=
5672 * initialCharacter internalCharacter* 5796 * initialCharacter internalCharacter*
5673 * 5797 *
5674 * initialCharacter ::= '_' | '$' | letter 5798 * initialCharacter ::= '_' | '$' | letter
5675 * 5799 *
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
6322 */ 6446 */
6323 Token get typedefKeyword; 6447 Token get typedefKeyword;
6324 6448
6325 /** 6449 /**
6326 * Set the token representing the 'typedef' keyword to the given [token]. 6450 * Set the token representing the 'typedef' keyword to the given [token].
6327 */ 6451 */
6328 void set typedefKeyword(Token token); 6452 void set typedefKeyword(Token token);
6329 } 6453 }
6330 6454
6331 /** 6455 /**
6456 * A type annotation.
6457 *
6458 * type ::=
6459 * [NamedType]
6460 * | [GenericFunctionType]
6461 *
6462 * Clients may not extend, implement or mix-in this class.
6463 */
6464 abstract class TypeAnnotation extends AstNode {
6465 /**
6466 * Return the type being named, or `null` if the AST structure has not been
6467 * resolved.
6468 */
6469 DartType get type;
6470 }
6471
6472 /**
6332 * A list of type arguments. 6473 * A list of type arguments.
6333 * 6474 *
6334 * typeArguments ::= 6475 * typeArguments ::=
6335 * '<' typeName (',' typeName)* '>' 6476 * '<' typeName (',' typeName)* '>'
6336 * 6477 *
6337 * Clients may not extend, implement or mix-in this class. 6478 * Clients may not extend, implement or mix-in this class.
6338 */ 6479 */
6339 abstract class TypeArgumentList extends AstNode { 6480 abstract class TypeArgumentList extends AstNode {
6340 /** 6481 /**
6341 * Return the type arguments associated with the type. 6482 * Return the type arguments associated with the type.
6342 */ 6483 */
6343 NodeList<TypeName> get arguments; 6484 NodeList<TypeAnnotation> get arguments;
6344 6485
6345 /** 6486 /**
6346 * Return the left bracket. 6487 * Return the left bracket.
6347 */ 6488 */
6348 Token get leftBracket; 6489 Token get leftBracket;
6349 6490
6350 /** 6491 /**
6351 * Set the left bracket to the given [token]. 6492 * Set the left bracket to the given [token].
6352 */ 6493 */
6353 void set leftBracket(Token token); 6494 void set leftBracket(Token token);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
6398 } 6539 }
6399 6540
6400 /** 6541 /**
6401 * The name of a type, which can optionally include type arguments. 6542 * The name of a type, which can optionally include type arguments.
6402 * 6543 *
6403 * typeName ::= 6544 * typeName ::=
6404 * [Identifier] typeArguments? 6545 * [Identifier] typeArguments?
6405 * 6546 *
6406 * Clients may not extend, implement or mix-in this class. 6547 * Clients may not extend, implement or mix-in this class.
6407 */ 6548 */
6408 abstract class TypeName extends AstNode { 6549 abstract class TypeName extends TypeAnnotation {
6409 /** 6550 /**
6410 * Return `true` if this type is a deferred type. 6551 * Return `true` if this type is a deferred type.
6411 * 6552 *
6412 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form 6553 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
6413 * </i>p.T</i> where <i>p</i> is a deferred prefix. 6554 * </i>p.T</i> where <i>p</i> is a deferred prefix.
6414 */ 6555 */
6415 bool get isDeferred; 6556 bool get isDeferred;
6416 6557
6417 /** 6558 /**
6418 * Return the name of the type. 6559 * Return the name of the type.
(...skipping 11 matching lines...) Expand all
6430 */ 6571 */
6431 Token get question; 6572 Token get question;
6432 6573
6433 /** 6574 /**
6434 * Return the question mark marking this as a nullable type to the given 6575 * Return the question mark marking this as a nullable type to the given
6435 * [question]. 6576 * [question].
6436 */ 6577 */
6437 void set question(Token question); 6578 void set question(Token question);
6438 6579
6439 /** 6580 /**
6440 * Return the type being named, or `null` if the AST structure has not been
6441 * resolved.
6442 */
6443 DartType get type;
6444
6445 /**
6446 * Set the type being named to the given [type]. 6581 * Set the type being named to the given [type].
6447 */ 6582 */
6448 void set type(DartType type); 6583 void set type(DartType type);
6449 6584
6450 /** 6585 /**
6451 * Return the type arguments associated with the type, or `null` if there are 6586 * Return the type arguments associated with the type, or `null` if there are
6452 * no type arguments. 6587 * no type arguments.
6453 */ 6588 */
6454 TypeArgumentList get typeArguments; 6589 TypeArgumentList get typeArguments;
6455 6590
6456 /** 6591 /**
6457 * Set the type arguments associated with the type to the given 6592 * Set the type arguments associated with the type to the given
6458 * [typeArguments]. 6593 * [typeArguments].
6459 */ 6594 */
6460 void set typeArguments(TypeArgumentList typeArguments); 6595 void set typeArguments(TypeArgumentList typeArguments);
6461 } 6596 }
6462 6597
6463 /** 6598 /**
6464 * A type parameter. 6599 * A type parameter.
6465 * 6600 *
6466 * typeParameter ::= 6601 * typeParameter ::=
6467 * [SimpleIdentifier] ('extends' [TypeName])? 6602 * [SimpleIdentifier] ('extends' [TypeAnnotation])?
6468 * 6603 *
6469 * Clients may not extend, implement or mix-in this class. 6604 * Clients may not extend, implement or mix-in this class.
6470 */ 6605 */
6471 abstract class TypeParameter extends Declaration { 6606 abstract class TypeParameter extends Declaration {
6472 /** 6607 /**
6473 * Return the name of the upper bound for legal arguments, or `null` if there 6608 * Return the upper bound for legal arguments, or `null` if there is no
6474 * is no explicit upper bound. 6609 * explicit upper bound.
6475 */ 6610 */
6476 TypeName get bound; 6611 TypeAnnotation get bound;
6477 6612
6478 /** 6613 /**
6479 * Set the name of the upper bound for legal arguments to the given 6614 * Set the upper bound for legal arguments to the given [type].
6480 * [typeName].
6481 */ 6615 */
6482 void set bound(TypeName typeName); 6616 void set bound(TypeAnnotation type);
6483 6617
6484 /** 6618 /**
6485 * Return the token representing the 'extends' keyword, or `null` if there is 6619 * Return the token representing the 'extends' keyword, or `null` if there is
6486 * no explicit upper bound. 6620 * no explicit upper bound.
6487 */ 6621 */
6488 Token get extendsKeyword; 6622 Token get extendsKeyword;
6489 6623
6490 /** 6624 /**
6491 * Set the token representing the 'extends' keyword to the given [token]. 6625 * Set the token representing the 'extends' keyword to the given [token].
6492 */ 6626 */
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
6655 void set name(SimpleIdentifier identifier); 6789 void set name(SimpleIdentifier identifier);
6656 } 6790 }
6657 6791
6658 /** 6792 /**
6659 * The declaration of one or more variables of the same type. 6793 * The declaration of one or more variables of the same type.
6660 * 6794 *
6661 * variableDeclarationList ::= 6795 * variableDeclarationList ::=
6662 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])* 6796 * finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
6663 * 6797 *
6664 * finalConstVarOrType ::= 6798 * finalConstVarOrType ::=
6665 * | 'final' [TypeName]? 6799 * | 'final' [TypeAnnotation]?
6666 * | 'const' [TypeName]? 6800 * | 'const' [TypeAnnotation]?
6667 * | 'var' 6801 * | 'var'
6668 * | [TypeName] 6802 * | [TypeAnnotation]
6669 * 6803 *
6670 * Clients may not extend, implement or mix-in this class. 6804 * Clients may not extend, implement or mix-in this class.
6671 */ 6805 */
6672 abstract class VariableDeclarationList extends AnnotatedNode { 6806 abstract class VariableDeclarationList extends AnnotatedNode {
6673 /** 6807 /**
6674 * Return `true` if the variables in this list were declared with the 'const' 6808 * Return `true` if the variables in this list were declared with the 'const'
6675 * modifier. 6809 * modifier.
6676 */ 6810 */
6677 bool get isConst; 6811 bool get isConst;
6678 6812
(...skipping 14 matching lines...) Expand all
6693 /** 6827 /**
6694 * Set the token representing the 'final', 'const' or 'var' keyword to the 6828 * Set the token representing the 'final', 'const' or 'var' keyword to the
6695 * given [token]. 6829 * given [token].
6696 */ 6830 */
6697 void set keyword(Token token); 6831 void set keyword(Token token);
6698 6832
6699 /** 6833 /**
6700 * Return the type of the variables being declared, or `null` if no type was 6834 * Return the type of the variables being declared, or `null` if no type was
6701 * provided. 6835 * provided.
6702 */ 6836 */
6703 TypeName get type; 6837 TypeAnnotation get type;
6704 6838
6705 /** 6839 /**
6706 * Set the type of the variables being declared to the given [typeName]. 6840 * Set the type of the variables being declared to the given [type].
6707 */ 6841 */
6708 void set type(TypeName typeName); 6842 void set type(TypeAnnotation type);
6709 6843
6710 /** 6844 /**
6711 * Return a list containing the individual variables being declared. 6845 * Return a list containing the individual variables being declared.
6712 */ 6846 */
6713 NodeList<VariableDeclaration> get variables; 6847 NodeList<VariableDeclaration> get variables;
6714 } 6848 }
6715 6849
6716 /** 6850 /**
6717 * A list of variables that are being declared in a context where a statement is 6851 * A list of variables that are being declared in a context where a statement is
6718 * required. 6852 * required.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6873 /** 7007 /**
6874 * Return the 'yield' keyword. 7008 * Return the 'yield' keyword.
6875 */ 7009 */
6876 Token get yieldKeyword; 7010 Token get yieldKeyword;
6877 7011
6878 /** 7012 /**
6879 * Return the 'yield' keyword to the given [token]. 7013 * Return the 'yield' keyword to the given [token].
6880 */ 7014 */
6881 void set yieldKeyword(Token token); 7015 void set yieldKeyword(Token token);
6882 } 7016 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698