OLD | NEW |
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 4274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4285 * [comment] and [metadata] can be `null` if the parameter does not have the | 4285 * [comment] and [metadata] can be `null` if the parameter does not have the |
4286 * corresponding attribute. The [returnType] can be `null` if no return type | 4286 * corresponding attribute. The [returnType] can be `null` if no return type |
4287 * was specified. | 4287 * was specified. |
4288 */ | 4288 */ |
4289 factory FunctionTypedFormalParameter( | 4289 factory FunctionTypedFormalParameter( |
4290 Comment comment, | 4290 Comment comment, |
4291 List<Annotation> metadata, | 4291 List<Annotation> metadata, |
4292 TypeName returnType, | 4292 TypeName returnType, |
4293 SimpleIdentifier identifier, | 4293 SimpleIdentifier identifier, |
4294 TypeParameterList typeParameters, | 4294 TypeParameterList typeParameters, |
4295 FormalParameterList parameters) => | 4295 FormalParameterList parameters, |
| 4296 {Token question: null}) => |
4296 new FunctionTypedFormalParameterImpl(comment, metadata, returnType, | 4297 new FunctionTypedFormalParameterImpl(comment, metadata, returnType, |
4297 identifier, typeParameters, parameters); | 4298 identifier, typeParameters, parameters, question); |
4298 | 4299 |
4299 /** | 4300 /** |
4300 * Return the parameters of the function-typed parameter. | 4301 * Return the parameters of the function-typed parameter. |
4301 */ | 4302 */ |
4302 FormalParameterList get parameters; | 4303 FormalParameterList get parameters; |
4303 | 4304 |
4304 /** | 4305 /** |
4305 * Set the parameters of the function-typed parameter to the given | 4306 * Set the parameters of the function-typed parameter to the given |
4306 * [parameters]. | 4307 * [parameters]. |
4307 */ | 4308 */ |
4308 void set parameters(FormalParameterList parameters); | 4309 void set parameters(FormalParameterList parameters); |
4309 | 4310 |
4310 /** | 4311 /** |
| 4312 * Return the question mark marking this as a nullable type, or `null` if |
| 4313 * the type is non-nullable. |
| 4314 */ |
| 4315 Token get question; |
| 4316 |
| 4317 /** |
| 4318 * Return the question mark marking this as a nullable type to the given |
| 4319 * [question]. |
| 4320 */ |
| 4321 void set question(Token question); |
| 4322 |
| 4323 /** |
4311 * Return the return type of the function, or `null` if the function does not | 4324 * Return the return type of the function, or `null` if the function does not |
4312 * have a return type. | 4325 * have a return type. |
4313 */ | 4326 */ |
4314 TypeName get returnType; | 4327 TypeName get returnType; |
4315 | 4328 |
4316 /** | 4329 /** |
4317 * Set the return type of the function to the given [type]. | 4330 * Set the return type of the function to the given [type]. |
4318 */ | 4331 */ |
4319 void set returnType(TypeName type); | 4332 void set returnType(TypeName type); |
4320 | 4333 |
(...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7717 * typeName ::= | 7730 * typeName ::= |
7718 * [Identifier] typeArguments? | 7731 * [Identifier] typeArguments? |
7719 * | 7732 * |
7720 * Clients may not extend, implement or mix-in this class. | 7733 * Clients may not extend, implement or mix-in this class. |
7721 */ | 7734 */ |
7722 abstract class TypeName extends AstNode { | 7735 abstract class TypeName extends AstNode { |
7723 /** | 7736 /** |
7724 * Initialize a newly created type name. The [typeArguments] can be `null` if | 7737 * Initialize a newly created type name. The [typeArguments] can be `null` if |
7725 * there are no type arguments. | 7738 * there are no type arguments. |
7726 */ | 7739 */ |
7727 factory TypeName(Identifier name, TypeArgumentList typeArguments) => | 7740 factory TypeName(Identifier name, TypeArgumentList typeArguments, |
7728 new TypeNameImpl(name, typeArguments); | 7741 {Token question: null}) => |
| 7742 new TypeNameImpl(name, typeArguments, question); |
7729 | 7743 |
7730 /** | 7744 /** |
7731 * Return `true` if this type is a deferred type. | 7745 * Return `true` if this type is a deferred type. |
7732 * | 7746 * |
7733 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form | 7747 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form |
7734 * </i>p.T</i> where <i>p</i> is a deferred prefix. | 7748 * </i>p.T</i> where <i>p</i> is a deferred prefix. |
7735 */ | 7749 */ |
7736 bool get isDeferred; | 7750 bool get isDeferred; |
7737 | 7751 |
7738 /** | 7752 /** |
7739 * Return the name of the type. | 7753 * Return the name of the type. |
7740 */ | 7754 */ |
7741 Identifier get name; | 7755 Identifier get name; |
7742 | 7756 |
7743 /** | 7757 /** |
7744 * Set the name of the type to the given [identifier]. | 7758 * Set the name of the type to the given [identifier]. |
7745 */ | 7759 */ |
7746 void set name(Identifier identifier); | 7760 void set name(Identifier identifier); |
7747 | 7761 |
7748 /** | 7762 /** |
| 7763 * Return the question mark marking this as a nullable type, or `null` if |
| 7764 * the type is non-nullable. |
| 7765 */ |
| 7766 Token get question; |
| 7767 |
| 7768 /** |
| 7769 * Return the question mark marking this as a nullable type to the given |
| 7770 * [question]. |
| 7771 */ |
| 7772 void set question(Token question); |
| 7773 |
| 7774 /** |
7749 * Return the type being named, or `null` if the AST structure has not been | 7775 * Return the type being named, or `null` if the AST structure has not been |
7750 * resolved. | 7776 * resolved. |
7751 */ | 7777 */ |
7752 DartType get type; | 7778 DartType get type; |
7753 | 7779 |
7754 /** | 7780 /** |
7755 * Set the type being named to the given [type]. | 7781 * Set the type being named to the given [type]. |
7756 */ | 7782 */ |
7757 void set type(DartType type); | 7783 void set type(DartType type); |
7758 | 7784 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8270 /** | 8296 /** |
8271 * Return the 'yield' keyword. | 8297 * Return the 'yield' keyword. |
8272 */ | 8298 */ |
8273 Token get yieldKeyword; | 8299 Token get yieldKeyword; |
8274 | 8300 |
8275 /** | 8301 /** |
8276 * Return the 'yield' keyword to the given [token]. | 8302 * Return the 'yield' keyword to the given [token]. |
8277 */ | 8303 */ |
8278 void set yieldKeyword(Token token); | 8304 void set yieldKeyword(Token token); |
8279 } | 8305 } |
OLD | NEW |