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

Side by Side Diff: pkg/analyzer/lib/src/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
« no previous file with comments | « pkg/analyzer/lib/dart/ast/visitor.dart ('k') | pkg/analyzer/lib/src/dart/ast/ast_factory.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library analyzer.src.dart.ast.ast; 5 library analyzer.src.dart.ast.ast;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/syntactic_entity.dart'; 10 import 'package:analyzer/dart/ast/syntactic_entity.dart';
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 */ 497 */
498 Expression _expression; 498 Expression _expression;
499 499
500 /** 500 /**
501 * The 'as' operator. 501 * The 'as' operator.
502 */ 502 */
503 @override 503 @override
504 Token asOperator; 504 Token asOperator;
505 505
506 /** 506 /**
507 * The name of the type being cast to. 507 * The type being cast to.
508 */ 508 */
509 TypeName _type; 509 TypeAnnotation _type;
510 510
511 /** 511 /**
512 * Initialize a newly created as expression. 512 * Initialize a newly created as expression.
513 */ 513 */
514 AsExpressionImpl( 514 AsExpressionImpl(
515 ExpressionImpl expression, this.asOperator, TypeNameImpl type) { 515 ExpressionImpl expression, this.asOperator, TypeAnnotationImpl type) {
516 _expression = _becomeParentOf(expression); 516 _expression = _becomeParentOf(expression);
517 _type = _becomeParentOf(type); 517 _type = _becomeParentOf(type);
518 } 518 }
519 519
520 @override 520 @override
521 Token get beginToken => _expression.beginToken; 521 Token get beginToken => _expression.beginToken;
522 522
523 @override 523 @override
524 Iterable<SyntacticEntity> get childEntities => 524 Iterable<SyntacticEntity> get childEntities =>
525 new ChildEntities()..add(_expression)..add(asOperator)..add(_type); 525 new ChildEntities()..add(_expression)..add(asOperator)..add(_type);
526 526
527 @override 527 @override
528 Token get endToken => _type.endToken; 528 Token get endToken => _type.endToken;
529 529
530 @override 530 @override
531 Expression get expression => _expression; 531 Expression get expression => _expression;
532 532
533 @override 533 @override
534 void set expression(Expression expression) { 534 void set expression(Expression expression) {
535 _expression = _becomeParentOf(expression as AstNodeImpl); 535 _expression = _becomeParentOf(expression as AstNodeImpl);
536 } 536 }
537 537
538 @override 538 @override
539 int get precedence => 7; 539 int get precedence => 7;
540 540
541 @override 541 @override
542 TypeName get type => _type; 542 TypeAnnotation get type => _type;
543 543
544 @override 544 @override
545 void set type(TypeName name) { 545 void set type(TypeAnnotation type) {
546 _type = _becomeParentOf(name as AstNodeImpl); 546 _type = _becomeParentOf(type as AstNodeImpl);
547 } 547 }
548 548
549 @override 549 @override
550 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 550 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
551 visitor.visitAsExpression(this); 551 visitor.visitAsExpression(this);
552 552
553 @override 553 @override
554 void visitChildren(AstVisitor visitor) { 554 void visitChildren(AstVisitor visitor) {
555 _expression?.accept(visitor); 555 _expression?.accept(visitor);
556 _type?.accept(visitor); 556 _type?.accept(visitor);
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 * The token representing the 'on' keyword, or `null` if there is no 'on' 1568 * The token representing the 'on' keyword, or `null` if there is no 'on'
1569 * keyword. 1569 * keyword.
1570 */ 1570 */
1571 @override 1571 @override
1572 Token onKeyword; 1572 Token onKeyword;
1573 1573
1574 /** 1574 /**
1575 * The type of exceptions caught by this catch clause, or `null` if this catch 1575 * The type of exceptions caught by this catch clause, or `null` if this catch
1576 * clause catches every type of exception. 1576 * clause catches every type of exception.
1577 */ 1577 */
1578 TypeName _exceptionType; 1578 TypeAnnotation _exceptionType;
1579 1579
1580 /** 1580 /**
1581 * The token representing the 'catch' keyword, or `null` if there is no 1581 * The token representing the 'catch' keyword, or `null` if there is no
1582 * 'catch' keyword. 1582 * 'catch' keyword.
1583 */ 1583 */
1584 @override 1584 @override
1585 Token catchKeyword; 1585 Token catchKeyword;
1586 1586
1587 /** 1587 /**
1588 * The left parenthesis, or `null` if there is no 'catch' keyword. 1588 * The left parenthesis, or `null` if there is no 'catch' keyword.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 Block _body; 1621 Block _body;
1622 1622
1623 /** 1623 /**
1624 * Initialize a newly created catch clause. The [onKeyword] and 1624 * Initialize a newly created catch clause. The [onKeyword] and
1625 * [exceptionType] can be `null` if the clause will catch all exceptions. The 1625 * [exceptionType] can be `null` if the clause will catch all exceptions. The
1626 * [comma] and [stackTraceParameter] can be `null` if the stack trace 1626 * [comma] and [stackTraceParameter] can be `null` if the stack trace
1627 * parameter is not defined. 1627 * parameter is not defined.
1628 */ 1628 */
1629 CatchClauseImpl( 1629 CatchClauseImpl(
1630 this.onKeyword, 1630 this.onKeyword,
1631 TypeNameImpl exceptionType, 1631 TypeAnnotationImpl exceptionType,
1632 this.catchKeyword, 1632 this.catchKeyword,
1633 this.leftParenthesis, 1633 this.leftParenthesis,
1634 SimpleIdentifierImpl exceptionParameter, 1634 SimpleIdentifierImpl exceptionParameter,
1635 this.comma, 1635 this.comma,
1636 SimpleIdentifierImpl stackTraceParameter, 1636 SimpleIdentifierImpl stackTraceParameter,
1637 this.rightParenthesis, 1637 this.rightParenthesis,
1638 BlockImpl body) { 1638 BlockImpl body) {
1639 _exceptionType = _becomeParentOf(exceptionType); 1639 _exceptionType = _becomeParentOf(exceptionType);
1640 _exceptionParameter = _becomeParentOf(exceptionParameter); 1640 _exceptionParameter = _becomeParentOf(exceptionParameter);
1641 _stackTraceParameter = _becomeParentOf(stackTraceParameter); 1641 _stackTraceParameter = _becomeParentOf(stackTraceParameter);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 1675
1676 @override 1676 @override
1677 SimpleIdentifier get exceptionParameter => _exceptionParameter; 1677 SimpleIdentifier get exceptionParameter => _exceptionParameter;
1678 1678
1679 @override 1679 @override
1680 void set exceptionParameter(SimpleIdentifier parameter) { 1680 void set exceptionParameter(SimpleIdentifier parameter) {
1681 _exceptionParameter = _becomeParentOf(parameter as AstNodeImpl); 1681 _exceptionParameter = _becomeParentOf(parameter as AstNodeImpl);
1682 } 1682 }
1683 1683
1684 @override 1684 @override
1685 TypeName get exceptionType => _exceptionType; 1685 TypeAnnotation get exceptionType => _exceptionType;
1686 1686
1687 @override 1687 @override
1688 void set exceptionType(TypeName exceptionType) { 1688 void set exceptionType(TypeAnnotation exceptionType) {
1689 _exceptionType = _becomeParentOf(exceptionType as AstNodeImpl); 1689 _exceptionType = _becomeParentOf(exceptionType as AstNodeImpl);
1690 } 1690 }
1691 1691
1692 @override 1692 @override
1693 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; 1693 SimpleIdentifier get stackTraceParameter => _stackTraceParameter;
1694 1694
1695 @override 1695 @override
1696 void set stackTraceParameter(SimpleIdentifier parameter) { 1696 void set stackTraceParameter(SimpleIdentifier parameter) {
1697 _stackTraceParameter = _becomeParentOf(parameter as AstNodeImpl); 1697 _stackTraceParameter = _becomeParentOf(parameter as AstNodeImpl);
1698 } 1698 }
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
3287 * The token representing either the 'final', 'const' or 'var' keyword, or 3287 * The token representing either the 'final', 'const' or 'var' keyword, or
3288 * `null` if no keyword was used. 3288 * `null` if no keyword was used.
3289 */ 3289 */
3290 @override 3290 @override
3291 Token keyword; 3291 Token keyword;
3292 3292
3293 /** 3293 /**
3294 * The name of the declared type of the parameter, or `null` if the parameter 3294 * The name of the declared type of the parameter, or `null` if the parameter
3295 * does not have a declared type. 3295 * does not have a declared type.
3296 */ 3296 */
3297 TypeName _type; 3297 TypeAnnotation _type;
3298 3298
3299 /** 3299 /**
3300 * The name of the variable being declared. 3300 * The name of the variable being declared.
3301 */ 3301 */
3302 SimpleIdentifier _identifier; 3302 SimpleIdentifier _identifier;
3303 3303
3304 /** 3304 /**
3305 * Initialize a newly created formal parameter. Either or both of the 3305 * Initialize a newly created formal parameter. Either or both of the
3306 * [comment] and [metadata] can be `null` if the declaration does not have the 3306 * [comment] and [metadata] can be `null` if the declaration does not have the
3307 * corresponding attribute. The [keyword] can be `null` if a type name is 3307 * corresponding attribute. The [keyword] can be `null` if a type name is
3308 * given. The [type] must be `null` if the keyword is 'var'. 3308 * given. The [type] must be `null` if the keyword is 'var'.
3309 */ 3309 */
3310 DeclaredIdentifierImpl(CommentImpl comment, List<Annotation> metadata, 3310 DeclaredIdentifierImpl(CommentImpl comment, List<Annotation> metadata,
3311 this.keyword, TypeNameImpl type, SimpleIdentifierImpl identifier) 3311 this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier)
3312 : super(comment, metadata) { 3312 : super(comment, metadata) {
3313 _type = _becomeParentOf(type); 3313 _type = _becomeParentOf(type);
3314 _identifier = _becomeParentOf(identifier); 3314 _identifier = _becomeParentOf(identifier);
3315 } 3315 }
3316 3316
3317 @override 3317 @override
3318 Iterable<SyntacticEntity> get childEntities => 3318 Iterable<SyntacticEntity> get childEntities =>
3319 super._childEntities..add(keyword)..add(_type)..add(_identifier); 3319 super._childEntities..add(keyword)..add(_type)..add(_identifier);
3320 3320
3321 @override 3321 @override
(...skipping 25 matching lines...) Expand all
3347 _identifier = _becomeParentOf(identifier as AstNodeImpl); 3347 _identifier = _becomeParentOf(identifier as AstNodeImpl);
3348 } 3348 }
3349 3349
3350 @override 3350 @override
3351 bool get isConst => keyword?.keyword == Keyword.CONST; 3351 bool get isConst => keyword?.keyword == Keyword.CONST;
3352 3352
3353 @override 3353 @override
3354 bool get isFinal => keyword?.keyword == Keyword.FINAL; 3354 bool get isFinal => keyword?.keyword == Keyword.FINAL;
3355 3355
3356 @override 3356 @override
3357 TypeName get type => _type; 3357 TypeAnnotation get type => _type;
3358 3358
3359 @override 3359 @override
3360 void set type(TypeName typeName) { 3360 void set type(TypeAnnotation type) {
3361 _type = _becomeParentOf(typeName as AstNodeImpl); 3361 _type = _becomeParentOf(type as AstNodeImpl);
3362 } 3362 }
3363 3363
3364 @override 3364 @override
3365 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 3365 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
3366 visitor.visitDeclaredIdentifier(this); 3366 visitor.visitDeclaredIdentifier(this);
3367 3367
3368 @override 3368 @override
3369 void visitChildren(AstVisitor visitor) { 3369 void visitChildren(AstVisitor visitor) {
3370 super.visitChildren(visitor); 3370 super.visitChildren(visitor);
3371 _type?.accept(visitor); 3371 _type?.accept(visitor);
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
4401 * The token representing either the 'final', 'const' or 'var' keyword, or 4401 * The token representing either the 'final', 'const' or 'var' keyword, or
4402 * `null` if no keyword was used. 4402 * `null` if no keyword was used.
4403 */ 4403 */
4404 @override 4404 @override
4405 Token keyword; 4405 Token keyword;
4406 4406
4407 /** 4407 /**
4408 * The name of the declared type of the parameter, or `null` if the parameter 4408 * The name of the declared type of the parameter, or `null` if the parameter
4409 * does not have a declared type. 4409 * does not have a declared type.
4410 */ 4410 */
4411 TypeName _type; 4411 TypeAnnotation _type;
4412 4412
4413 /** 4413 /**
4414 * The token representing the 'this' keyword. 4414 * The token representing the 'this' keyword.
4415 */ 4415 */
4416 @override 4416 @override
4417 Token thisKeyword; 4417 Token thisKeyword;
4418 4418
4419 /** 4419 /**
4420 * The token representing the period. 4420 * The token representing the period.
4421 */ 4421 */
(...skipping 18 matching lines...) Expand all
4440 * corresponding attribute. The [keyword] can be `null` if there is a type. 4440 * corresponding attribute. The [keyword] can be `null` if there is a type.
4441 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and 4441 * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
4442 * [period] can be `null` if the keyword 'this' was not provided. The 4442 * [period] can be `null` if the keyword 'this' was not provided. The
4443 * [parameters] can be `null` if this is not a function-typed field formal 4443 * [parameters] can be `null` if this is not a function-typed field formal
4444 * parameter. 4444 * parameter.
4445 */ 4445 */
4446 FieldFormalParameterImpl( 4446 FieldFormalParameterImpl(
4447 CommentImpl comment, 4447 CommentImpl comment,
4448 List<Annotation> metadata, 4448 List<Annotation> metadata,
4449 this.keyword, 4449 this.keyword,
4450 TypeNameImpl type, 4450 TypeAnnotationImpl type,
4451 this.thisKeyword, 4451 this.thisKeyword,
4452 this.period, 4452 this.period,
4453 SimpleIdentifierImpl identifier, 4453 SimpleIdentifierImpl identifier,
4454 TypeParameterListImpl typeParameters, 4454 TypeParameterListImpl typeParameters,
4455 FormalParameterListImpl parameters) 4455 FormalParameterListImpl parameters)
4456 : super(comment, metadata, identifier) { 4456 : super(comment, metadata, identifier) {
4457 _type = _becomeParentOf(type); 4457 _type = _becomeParentOf(type);
4458 _typeParameters = _becomeParentOf(typeParameters); 4458 _typeParameters = _becomeParentOf(typeParameters);
4459 _parameters = _becomeParentOf(parameters); 4459 _parameters = _becomeParentOf(parameters);
4460 } 4460 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4494 4494
4495 @override 4495 @override
4496 FormalParameterList get parameters => _parameters; 4496 FormalParameterList get parameters => _parameters;
4497 4497
4498 @override 4498 @override
4499 void set parameters(FormalParameterList parameters) { 4499 void set parameters(FormalParameterList parameters) {
4500 _parameters = _becomeParentOf(parameters as AstNodeImpl); 4500 _parameters = _becomeParentOf(parameters as AstNodeImpl);
4501 } 4501 }
4502 4502
4503 @override 4503 @override
4504 TypeName get type => _type; 4504 TypeAnnotation get type => _type;
4505 4505
4506 @override 4506 @override
4507 void set type(TypeName typeName) { 4507 void set type(TypeAnnotation type) {
4508 _type = _becomeParentOf(typeName as AstNodeImpl); 4508 _type = _becomeParentOf(type as AstNodeImpl);
4509 } 4509 }
4510 4510
4511 @override 4511 @override
4512 TypeParameterList get typeParameters => _typeParameters; 4512 TypeParameterList get typeParameters => _typeParameters;
4513 4513
4514 @override 4514 @override
4515 void set typeParameters(TypeParameterList typeParameters) { 4515 void set typeParameters(TypeParameterList typeParameters) {
4516 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 4516 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
4517 } 4517 }
4518 4518
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 /** 5077 /**
5078 * The token representing the 'external' keyword, or `null` if this is not an 5078 * The token representing the 'external' keyword, or `null` if this is not an
5079 * external function. 5079 * external function.
5080 */ 5080 */
5081 @override 5081 @override
5082 Token externalKeyword; 5082 Token externalKeyword;
5083 5083
5084 /** 5084 /**
5085 * The return type of the function, or `null` if no return type was declared. 5085 * The return type of the function, or `null` if no return type was declared.
5086 */ 5086 */
5087 TypeName _returnType; 5087 TypeAnnotation _returnType;
5088 5088
5089 /** 5089 /**
5090 * The token representing the 'get' or 'set' keyword, or `null` if this is a 5090 * The token representing the 'get' or 'set' keyword, or `null` if this is a
5091 * function declaration rather than a property declaration. 5091 * function declaration rather than a property declaration.
5092 */ 5092 */
5093 @override 5093 @override
5094 Token propertyKeyword; 5094 Token propertyKeyword;
5095 5095
5096 /** 5096 /**
5097 * The function expression being wrapped. 5097 * The function expression being wrapped.
5098 */ 5098 */
5099 FunctionExpression _functionExpression; 5099 FunctionExpression _functionExpression;
5100 5100
5101 /** 5101 /**
5102 * Initialize a newly created function declaration. Either or both of the 5102 * Initialize a newly created function declaration. Either or both of the
5103 * [comment] and [metadata] can be `null` if the function does not have the 5103 * [comment] and [metadata] can be `null` if the function does not have the
5104 * corresponding attribute. The [externalKeyword] can be `null` if the 5104 * corresponding attribute. The [externalKeyword] can be `null` if the
5105 * function is not an external function. The [returnType] can be `null` if no 5105 * function is not an external function. The [returnType] can be `null` if no
5106 * return type was specified. The [propertyKeyword] can be `null` if the 5106 * return type was specified. The [propertyKeyword] can be `null` if the
5107 * function is neither a getter or a setter. 5107 * function is neither a getter or a setter.
5108 */ 5108 */
5109 FunctionDeclarationImpl( 5109 FunctionDeclarationImpl(
5110 CommentImpl comment, 5110 CommentImpl comment,
5111 List<Annotation> metadata, 5111 List<Annotation> metadata,
5112 this.externalKeyword, 5112 this.externalKeyword,
5113 TypeNameImpl returnType, 5113 TypeAnnotationImpl returnType,
5114 this.propertyKeyword, 5114 this.propertyKeyword,
5115 SimpleIdentifierImpl name, 5115 SimpleIdentifierImpl name,
5116 FunctionExpressionImpl functionExpression) 5116 FunctionExpressionImpl functionExpression)
5117 : super(comment, metadata, name) { 5117 : super(comment, metadata, name) {
5118 _returnType = _becomeParentOf(returnType); 5118 _returnType = _becomeParentOf(returnType);
5119 _functionExpression = _becomeParentOf(functionExpression); 5119 _functionExpression = _becomeParentOf(functionExpression);
5120 } 5120 }
5121 5121
5122 @override 5122 @override
5123 Iterable<SyntacticEntity> get childEntities => super._childEntities 5123 Iterable<SyntacticEntity> get childEntities => super._childEntities
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5155 _functionExpression = _becomeParentOf(functionExpression as AstNodeImpl); 5155 _functionExpression = _becomeParentOf(functionExpression as AstNodeImpl);
5156 } 5156 }
5157 5157
5158 @override 5158 @override
5159 bool get isGetter => propertyKeyword?.keyword == Keyword.GET; 5159 bool get isGetter => propertyKeyword?.keyword == Keyword.GET;
5160 5160
5161 @override 5161 @override
5162 bool get isSetter => propertyKeyword?.keyword == Keyword.SET; 5162 bool get isSetter => propertyKeyword?.keyword == Keyword.SET;
5163 5163
5164 @override 5164 @override
5165 TypeName get returnType => _returnType; 5165 TypeAnnotation get returnType => _returnType;
5166 5166
5167 @override 5167 @override
5168 void set returnType(TypeName returnType) { 5168 void set returnType(TypeAnnotation type) {
5169 _returnType = _becomeParentOf(returnType as AstNodeImpl); 5169 _returnType = _becomeParentOf(type as AstNodeImpl);
5170 } 5170 }
5171 5171
5172 @override 5172 @override
5173 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 5173 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
5174 visitor.visitFunctionDeclaration(this); 5174 visitor.visitFunctionDeclaration(this);
5175 5175
5176 @override 5176 @override
5177 void visitChildren(AstVisitor visitor) { 5177 void visitChildren(AstVisitor visitor) {
5178 super.visitChildren(visitor); 5178 super.visitChildren(visitor);
5179 _returnType?.accept(visitor); 5179 _returnType?.accept(visitor);
5180 _name?.accept(visitor); 5180 _name?.accept(visitor);
5181 _functionExpression?.accept(visitor); 5181 _functionExpression?.accept(visitor);
5182 } 5182 }
5183 } 5183 }
5184 5184
5185 /** 5185 /**
5186 * A [FunctionDeclaration] used as a statement. 5186 * A [FunctionDeclaration] used as a statement.
5187 */ 5187 */
5188 class FunctionDeclarationStatementImpl extends StatementImpl 5188 class FunctionDeclarationStatementImpl extends StatementImpl
5189 implements FunctionDeclarationStatement { 5189 implements FunctionDeclarationStatement {
5190 /** 5190 /**
5191 * The function declaration being wrapped. 5191 * The function declaration being wrapped.
5192 */ 5192 */
5193 FunctionDeclaration _functionDeclaration; 5193 FunctionDeclaration _functionDeclaration;
5194 5194
5195 /** 5195 /**
5196 * Initialize a newly created function declaration statement. 5196 * Initialize a newly created function declaration statement.
5197 */ 5197 */
5198 FunctionDeclarationStatementImpl(FunctionDeclaration functionDeclaration) { 5198 FunctionDeclarationStatementImpl(
5199 _functionDeclaration = _becomeParentOf(functionDeclaration as AstNodeImpl); 5199 FunctionDeclarationImpl functionDeclaration) {
5200 _functionDeclaration = _becomeParentOf(functionDeclaration);
5200 } 5201 }
5201 5202
5202 @override 5203 @override
5203 Token get beginToken => _functionDeclaration.beginToken; 5204 Token get beginToken => _functionDeclaration.beginToken;
5204 5205
5205 @override 5206 @override
5206 Iterable<SyntacticEntity> get childEntities => 5207 Iterable<SyntacticEntity> get childEntities =>
5207 new ChildEntities()..add(_functionDeclaration); 5208 new ChildEntities()..add(_functionDeclaration);
5208 5209
5209 @override 5210 @override
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5427 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' 5428 * functionPrefix [TypeParameterList]? [FormalParameterList] ';'
5428 * 5429 *
5429 * functionPrefix ::= 5430 * functionPrefix ::=
5430 * [TypeName]? [SimpleIdentifier] 5431 * [TypeName]? [SimpleIdentifier]
5431 */ 5432 */
5432 class FunctionTypeAliasImpl extends TypeAliasImpl implements FunctionTypeAlias { 5433 class FunctionTypeAliasImpl extends TypeAliasImpl implements FunctionTypeAlias {
5433 /** 5434 /**
5434 * The name of the return type of the function type being defined, or `null` 5435 * The name of the return type of the function type being defined, or `null`
5435 * if no return type was given. 5436 * if no return type was given.
5436 */ 5437 */
5437 TypeName _returnType; 5438 TypeAnnotation _returnType;
5438 5439
5439 /** 5440 /**
5440 * The type parameters for the function type, or `null` if the function type 5441 * The type parameters for the function type, or `null` if the function type
5441 * does not have any type parameters. 5442 * does not have any type parameters.
5442 */ 5443 */
5443 TypeParameterList _typeParameters; 5444 TypeParameterList _typeParameters;
5444 5445
5445 /** 5446 /**
5446 * The parameters associated with the function type. 5447 * The parameters associated with the function type.
5447 */ 5448 */
5448 FormalParameterList _parameters; 5449 FormalParameterList _parameters;
5449 5450
5450 /** 5451 /**
5451 * Initialize a newly created function type alias. Either or both of the 5452 * Initialize a newly created function type alias. Either or both of the
5452 * [comment] and [metadata] can be `null` if the function does not have the 5453 * [comment] and [metadata] can be `null` if the function does not have the
5453 * corresponding attribute. The [returnType] can be `null` if no return type 5454 * corresponding attribute. The [returnType] can be `null` if no return type
5454 * was specified. The [typeParameters] can be `null` if the function has no 5455 * was specified. The [typeParameters] can be `null` if the function has no
5455 * type parameters. 5456 * type parameters.
5456 */ 5457 */
5457 FunctionTypeAliasImpl( 5458 FunctionTypeAliasImpl(
5458 CommentImpl comment, 5459 CommentImpl comment,
5459 List<Annotation> metadata, 5460 List<Annotation> metadata,
5460 Token keyword, 5461 Token keyword,
5461 TypeNameImpl returnType, 5462 TypeAnnotationImpl returnType,
5462 SimpleIdentifierImpl name, 5463 SimpleIdentifierImpl name,
5463 TypeParameterListImpl typeParameters, 5464 TypeParameterListImpl typeParameters,
5464 FormalParameterListImpl parameters, 5465 FormalParameterListImpl parameters,
5465 Token semicolon) 5466 Token semicolon)
5466 : super(comment, metadata, keyword, name, semicolon) { 5467 : super(comment, metadata, keyword, name, semicolon) {
5467 _returnType = _becomeParentOf(returnType); 5468 _returnType = _becomeParentOf(returnType);
5468 _typeParameters = _becomeParentOf(typeParameters); 5469 _typeParameters = _becomeParentOf(typeParameters);
5469 _parameters = _becomeParentOf(parameters); 5470 _parameters = _becomeParentOf(parameters);
5470 } 5471 }
5471 5472
(...skipping 12 matching lines...) Expand all
5484 5485
5485 @override 5486 @override
5486 FormalParameterList get parameters => _parameters; 5487 FormalParameterList get parameters => _parameters;
5487 5488
5488 @override 5489 @override
5489 void set parameters(FormalParameterList parameters) { 5490 void set parameters(FormalParameterList parameters) {
5490 _parameters = _becomeParentOf(parameters as AstNodeImpl); 5491 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5491 } 5492 }
5492 5493
5493 @override 5494 @override
5494 TypeName get returnType => _returnType; 5495 TypeAnnotation get returnType => _returnType;
5495 5496
5496 @override 5497 @override
5497 void set returnType(TypeName typeName) { 5498 void set returnType(TypeAnnotation type) {
5498 _returnType = _becomeParentOf(typeName as AstNodeImpl); 5499 _returnType = _becomeParentOf(type as AstNodeImpl);
5499 } 5500 }
5500 5501
5501 @override 5502 @override
5502 TypeParameterList get typeParameters => _typeParameters; 5503 TypeParameterList get typeParameters => _typeParameters;
5503 5504
5504 @override 5505 @override
5505 void set typeParameters(TypeParameterList typeParameters) { 5506 void set typeParameters(TypeParameterList typeParameters) {
5506 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 5507 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5507 } 5508 }
5508 5509
(...skipping 16 matching lines...) Expand all
5525 * 5526 *
5526 * functionSignature ::= 5527 * functionSignature ::=
5527 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st] 5528 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st]
5528 */ 5529 */
5529 class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl 5530 class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl
5530 implements FunctionTypedFormalParameter { 5531 implements FunctionTypedFormalParameter {
5531 /** 5532 /**
5532 * The return type of the function, or `null` if the function does not have a 5533 * The return type of the function, or `null` if the function does not have a
5533 * return type. 5534 * return type.
5534 */ 5535 */
5535 TypeName _returnType; 5536 TypeAnnotation _returnType;
5536 5537
5537 /** 5538 /**
5538 * The type parameters associated with the function, or `null` if the function 5539 * The type parameters associated with the function, or `null` if the function
5539 * is not a generic function. 5540 * is not a generic function.
5540 */ 5541 */
5541 TypeParameterList _typeParameters; 5542 TypeParameterList _typeParameters;
5542 5543
5543 /** 5544 /**
5544 * The parameters of the function-typed parameter. 5545 * The parameters of the function-typed parameter.
5545 */ 5546 */
5546 FormalParameterList _parameters; 5547 FormalParameterList _parameters;
5547 5548
5548 @override 5549 @override
5549 Token question; 5550 Token question;
5550 5551
5551 /** 5552 /**
5552 * Initialize a newly created formal parameter. Either or both of the 5553 * Initialize a newly created formal parameter. Either or both of the
5553 * [comment] and [metadata] can be `null` if the parameter does not have the 5554 * [comment] and [metadata] can be `null` if the parameter does not have the
5554 * corresponding attribute. The [returnType] can be `null` if no return type 5555 * corresponding attribute. The [returnType] can be `null` if no return type
5555 * was specified. 5556 * was specified.
5556 */ 5557 */
5557 FunctionTypedFormalParameterImpl( 5558 FunctionTypedFormalParameterImpl(
5558 CommentImpl comment, 5559 CommentImpl comment,
5559 List<Annotation> metadata, 5560 List<Annotation> metadata,
5560 TypeNameImpl returnType, 5561 TypeAnnotationImpl returnType,
5561 SimpleIdentifierImpl identifier, 5562 SimpleIdentifierImpl identifier,
5562 TypeParameterListImpl typeParameters, 5563 TypeParameterListImpl typeParameters,
5563 FormalParameterListImpl parameters, 5564 FormalParameterListImpl parameters,
5564 this.question) 5565 this.question)
5565 : super(comment, metadata, identifier) { 5566 : super(comment, metadata, identifier) {
5566 _returnType = _becomeParentOf(returnType); 5567 _returnType = _becomeParentOf(returnType);
5567 _typeParameters = _becomeParentOf(typeParameters); 5568 _typeParameters = _becomeParentOf(typeParameters);
5568 _parameters = _becomeParentOf(parameters); 5569 _parameters = _becomeParentOf(parameters);
5569 } 5570 }
5570 5571
(...skipping 20 matching lines...) Expand all
5591 5592
5592 @override 5593 @override
5593 FormalParameterList get parameters => _parameters; 5594 FormalParameterList get parameters => _parameters;
5594 5595
5595 @override 5596 @override
5596 void set parameters(FormalParameterList parameters) { 5597 void set parameters(FormalParameterList parameters) {
5597 _parameters = _becomeParentOf(parameters as AstNodeImpl); 5598 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5598 } 5599 }
5599 5600
5600 @override 5601 @override
5601 TypeName get returnType => _returnType; 5602 TypeAnnotation get returnType => _returnType;
5602 5603
5603 @override 5604 @override
5604 void set returnType(TypeName type) { 5605 void set returnType(TypeAnnotation type) {
5605 _returnType = _becomeParentOf(type as AstNodeImpl); 5606 _returnType = _becomeParentOf(type as AstNodeImpl);
5606 } 5607 }
5607 5608
5608 @override 5609 @override
5609 TypeParameterList get typeParameters => _typeParameters; 5610 TypeParameterList get typeParameters => _typeParameters;
5610 5611
5611 @override 5612 @override
5612 void set typeParameters(TypeParameterList typeParameters) { 5613 void set typeParameters(TypeParameterList typeParameters) {
5613 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 5614 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5614 } 5615 }
5615 5616
5616 @override 5617 @override
5617 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 5618 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
5618 visitor.visitFunctionTypedFormalParameter(this); 5619 visitor.visitFunctionTypedFormalParameter(this);
5619 5620
5620 @override 5621 @override
5621 void visitChildren(AstVisitor visitor) { 5622 void visitChildren(AstVisitor visitor) {
5622 super.visitChildren(visitor); 5623 super.visitChildren(visitor);
5623 _returnType?.accept(visitor); 5624 _returnType?.accept(visitor);
5624 identifier?.accept(visitor); 5625 identifier?.accept(visitor);
5625 _typeParameters?.accept(visitor); 5626 _typeParameters?.accept(visitor);
5626 _parameters?.accept(visitor); 5627 _parameters?.accept(visitor);
5627 } 5628 }
5628 } 5629 }
5629 5630
5630 /** 5631 /**
5632 * An anonymous function type.
5633 *
5634 * functionType ::=
5635 * [TypeAnnotation]? 'Function' [TypeParameterList]? [FormalParameterList ]
5636 *
5637 * where the FormalParameterList is being used to represent the following
5638 * grammar, despite the fact that FormalParameterList can represent a much
5639 * larger grammar than the one below. This is done in order to simplify the
5640 * implementation.
5641 *
5642 * parameterTypeList ::=
5643 * () |
5644 * ( normalParameterTypes ,? ) |
5645 * ( normalParameterTypes , optionalParameterTypes ) |
5646 * ( optionalParameterTypes )
5647 * namedParameterTypes ::=
5648 * { namedParameterType (, namedParameterType)* ,? }
5649 * namedParameterType ::=
5650 * [TypeAnnotation]? [SimpleIdentifier]
5651 * normalParameterTypes ::=
5652 * normalParameterType (, normalParameterType)*
5653 * normalParameterType ::=
5654 * [TypeAnnotation] [SimpleIdentifier]?
5655 * optionalParameterTypes ::=
5656 * optionalPositionalParameterTypes | namedParameterTypes
5657 * optionalPositionalParameterTypes ::=
5658 * [ normalParameterTypes ,? ]
5659 */
5660 class GenericFunctionTypeImpl extends TypeAnnotationImpl
5661 implements GenericFunctionType {
5662 /**
5663 * The name of the return type of the function type being defined, or
5664 * `null` if no return type was given.
5665 */
5666 TypeAnnotation _returnType;
5667
5668 @override
5669 Token functionKeyword;
5670
5671 /**
5672 * The type parameters for the function type, or `null` if the function type
5673 * does not have any type parameters.
5674 */
5675 TypeParameterList _typeParameters;
5676
5677 /**
5678 * The parameters associated with the function type.
5679 */
5680 FormalParameterList _parameters;
5681
5682 /**
5683 * Initialize a newly created generic function type.
5684 */
5685 GenericFunctionTypeImpl(
5686 TypeAnnotationImpl returnType,
5687 this.functionKeyword,
5688 TypeParameterListImpl typeParameters,
5689 FormalParameterListImpl parameters) {
5690 _returnType = _becomeParentOf(returnType);
5691 _typeParameters = _becomeParentOf(typeParameters);
5692 _parameters = _becomeParentOf(parameters);
5693 }
5694
5695 @override
5696 Token get beginToken =>
5697 _returnType == null ? functionKeyword : _returnType.beginToken;
5698
5699 @override
5700 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
5701 ..add(_returnType)
5702 ..add(functionKeyword)
5703 ..add(_typeParameters)
5704 ..add(_parameters);
5705
5706 @override
5707 Token get endToken => _parameters.endToken;
5708
5709 @override
5710 FormalParameterList get parameters => _parameters;
5711
5712 @override
5713 void set parameters(FormalParameterList parameters) {
5714 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5715 }
5716
5717 @override
5718 TypeAnnotation get returnType => _returnType;
5719
5720 @override
5721 void set returnType(TypeAnnotation type) {
5722 _returnType = _becomeParentOf(type as AstNodeImpl);
5723 }
5724
5725 @override
5726 DartType get type => null;
5727
5728 /**
5729 * Return the type parameters for the function type, or `null` if the function
5730 * type does not have any type parameters.
5731 */
5732 TypeParameterList get typeParameters => _typeParameters;
5733
5734 /**
5735 * Set the type parameters for the function type to the given list of
5736 * [typeParameters].
5737 */
5738 void set typeParameters(TypeParameterList typeParameters) {
5739 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5740 }
5741
5742 // TODO: implement type
5743 @override
5744 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) {
5745 return visitor.visitGenericFunctionType(this);
5746 }
5747
5748 @override
5749 void visitChildren(AstVisitor visitor) {
5750 _returnType?.accept(visitor);
5751 _typeParameters?.accept(visitor);
5752 _parameters?.accept(visitor);
5753 }
5754 }
5755
5756 /**
5757 * A generic type alias.
5758 *
5759 * functionTypeAlias ::=
5760 * metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [Function Type] ';'
5761 */
5762 class GenericTypeAliasImpl extends TypeAliasImpl implements GenericTypeAlias {
5763 /**
5764 * The type parameters for the function type, or `null` if the function
5765 * type does not have any type parameters.
5766 */
5767 TypeParameterList _typeParameters;
5768
5769 @override
5770 Token equals;
5771
5772 /**
5773 * The type of function being defined by the alias.
5774 */
5775 GenericFunctionType _functionType;
5776
5777 /**
5778 * Returns a newly created generic type alias. Either or both of the
5779 * [comment] and [metadata] can be `null` if the variable list does not have
5780 * the corresponding attribute. The [typeParameters] can be `null` if there
5781 * are no type parameters.
5782 */
5783 GenericTypeAliasImpl(
5784 Comment comment,
5785 List<Annotation> metadata,
5786 Token typedefToken,
5787 SimpleIdentifier name,
5788 TypeParameterListImpl typeParameters,
5789 this.equals,
5790 GenericFunctionTypeImpl functionType,
5791 Token semicolon)
5792 : super(comment, metadata, typedefToken, name, semicolon) {
5793 _typeParameters = _becomeParentOf(typeParameters);
5794 _functionType = _becomeParentOf(functionType);
5795 }
5796
5797 @override
5798 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
5799 ..addAll(metadata)
5800 ..add(typedefKeyword)
5801 ..add(name)
5802 ..add(_typeParameters)
5803 ..add(equals)
5804 ..add(_functionType);
5805 @override
5806 Element get element => null;
5807
5808 @override
5809 GenericFunctionType get functionType => _functionType;
5810
5811 @override
5812 void set functionType(GenericFunctionType functionType) {
5813 _functionType = _becomeParentOf(functionType as AstNodeImpl);
5814 }
5815
5816 @override
5817 TypeParameterList get typeParameters => _typeParameters;
5818
5819 @override
5820 void set typeParameters(TypeParameterList typeParameters) {
5821 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5822 }
5823
5824 @override
5825 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) {
5826 return visitor.visitGenericTypeAlias(this);
5827 }
5828
5829 // TODO: implement element
5830 @override
5831 void visitChildren(AstVisitor visitor) {
5832 super.visitChildren(visitor);
5833 name?.accept(visitor);
5834 _typeParameters?.accept(visitor);
5835 _functionType?.accept(visitor);
5836 }
5837 }
5838
5839 /**
5631 * A combinator that restricts the names being imported to those that are not in 5840 * A combinator that restricts the names being imported to those that are not in
5632 * a given list. 5841 * a given list.
5633 * 5842 *
5634 * hideCombinator ::= 5843 * hideCombinator ::=
5635 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* 5844 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
5636 */ 5845 */
5637 class HideCombinatorImpl extends CombinatorImpl implements HideCombinator { 5846 class HideCombinatorImpl extends CombinatorImpl implements HideCombinator {
5638 /** 5847 /**
5639 * The list of names from the library that are hidden by this combinator. 5848 * The list of names from the library that are hidden by this combinator.
5640 */ 5849 */
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6520 6729
6521 /** 6730 /**
6522 * The not operator, or `null` if the sense of the test is not negated. 6731 * The not operator, or `null` if the sense of the test is not negated.
6523 */ 6732 */
6524 @override 6733 @override
6525 Token notOperator; 6734 Token notOperator;
6526 6735
6527 /** 6736 /**
6528 * The name of the type being tested for. 6737 * The name of the type being tested for.
6529 */ 6738 */
6530 TypeName _type; 6739 TypeAnnotation _type;
6531 6740
6532 /** 6741 /**
6533 * Initialize a newly created is expression. The [notOperator] can be `null` 6742 * Initialize a newly created is expression. The [notOperator] can be `null`
6534 * if the sense of the test is not negated. 6743 * if the sense of the test is not negated.
6535 */ 6744 */
6536 IsExpressionImpl(ExpressionImpl expression, this.isOperator, this.notOperator, 6745 IsExpressionImpl(ExpressionImpl expression, this.isOperator, this.notOperator,
6537 TypeNameImpl type) { 6746 TypeAnnotationImpl type) {
6538 _expression = _becomeParentOf(expression); 6747 _expression = _becomeParentOf(expression);
6539 _type = _becomeParentOf(type); 6748 _type = _becomeParentOf(type);
6540 } 6749 }
6541 6750
6542 @override 6751 @override
6543 Token get beginToken => _expression.beginToken; 6752 Token get beginToken => _expression.beginToken;
6544 6753
6545 @override 6754 @override
6546 Iterable<SyntacticEntity> get childEntities => new ChildEntities() 6755 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
6547 ..add(_expression) 6756 ..add(_expression)
6548 ..add(isOperator) 6757 ..add(isOperator)
6549 ..add(notOperator) 6758 ..add(notOperator)
6550 ..add(_type); 6759 ..add(_type);
6551 6760
6552 @override 6761 @override
6553 Token get endToken => _type.endToken; 6762 Token get endToken => _type.endToken;
6554 6763
6555 @override 6764 @override
6556 Expression get expression => _expression; 6765 Expression get expression => _expression;
6557 6766
6558 @override 6767 @override
6559 void set expression(Expression expression) { 6768 void set expression(Expression expression) {
6560 _expression = _becomeParentOf(expression as AstNodeImpl); 6769 _expression = _becomeParentOf(expression as AstNodeImpl);
6561 } 6770 }
6562 6771
6563 @override 6772 @override
6564 int get precedence => 7; 6773 int get precedence => 7;
6565 6774
6566 @override 6775 @override
6567 TypeName get type => _type; 6776 TypeAnnotation get type => _type;
6568 6777
6569 @override 6778 @override
6570 void set type(TypeName name) { 6779 void set type(TypeAnnotation type) {
6571 _type = _becomeParentOf(name as AstNodeImpl); 6780 _type = _becomeParentOf(type as AstNodeImpl);
6572 } 6781 }
6573 6782
6574 @override 6783 @override
6575 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 6784 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
6576 visitor.visitIsExpression(this); 6785 visitor.visitIsExpression(this);
6577 6786
6578 @override 6787 @override
6579 void visitChildren(AstVisitor visitor) { 6788 void visitChildren(AstVisitor visitor) {
6580 _expression?.accept(visitor); 6789 _expression?.accept(visitor);
6581 _type?.accept(visitor); 6790 _type?.accept(visitor);
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
7117 /** 7326 /**
7118 * The token representing the 'abstract' or 'static' keyword, or `null` if 7327 * The token representing the 'abstract' or 'static' keyword, or `null` if
7119 * neither modifier was specified. 7328 * neither modifier was specified.
7120 */ 7329 */
7121 @override 7330 @override
7122 Token modifierKeyword; 7331 Token modifierKeyword;
7123 7332
7124 /** 7333 /**
7125 * The return type of the method, or `null` if no return type was declared. 7334 * The return type of the method, or `null` if no return type was declared.
7126 */ 7335 */
7127 TypeName _returnType; 7336 TypeAnnotation _returnType;
7128 7337
7129 /** 7338 /**
7130 * The token representing the 'get' or 'set' keyword, or `null` if this is a 7339 * The token representing the 'get' or 'set' keyword, or `null` if this is a
7131 * method declaration rather than a property declaration. 7340 * method declaration rather than a property declaration.
7132 */ 7341 */
7133 @override 7342 @override
7134 Token propertyKeyword; 7343 Token propertyKeyword;
7135 7344
7136 /** 7345 /**
7137 * The token representing the 'operator' keyword, or `null` if this method 7346 * The token representing the 'operator' keyword, or `null` if this method
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
7171 * type was specified. The [propertyKeyword] can be `null` if the method is 7380 * type was specified. The [propertyKeyword] can be `null` if the method is
7172 * neither a getter or a setter. The [operatorKeyword] can be `null` if the 7381 * neither a getter or a setter. The [operatorKeyword] can be `null` if the
7173 * method does not implement an operator. The [parameters] must be `null` if 7382 * method does not implement an operator. The [parameters] must be `null` if
7174 * this method declares a getter. 7383 * this method declares a getter.
7175 */ 7384 */
7176 MethodDeclarationImpl( 7385 MethodDeclarationImpl(
7177 CommentImpl comment, 7386 CommentImpl comment,
7178 List<Annotation> metadata, 7387 List<Annotation> metadata,
7179 this.externalKeyword, 7388 this.externalKeyword,
7180 this.modifierKeyword, 7389 this.modifierKeyword,
7181 TypeNameImpl returnType, 7390 TypeAnnotationImpl returnType,
7182 this.propertyKeyword, 7391 this.propertyKeyword,
7183 this.operatorKeyword, 7392 this.operatorKeyword,
7184 SimpleIdentifierImpl name, 7393 SimpleIdentifierImpl name,
7185 TypeParameterListImpl typeParameters, 7394 TypeParameterListImpl typeParameters,
7186 FormalParameterListImpl parameters, 7395 FormalParameterListImpl parameters,
7187 FunctionBodyImpl body) 7396 FunctionBodyImpl body)
7188 : super(comment, metadata) { 7397 : super(comment, metadata) {
7189 _returnType = _becomeParentOf(returnType); 7398 _returnType = _becomeParentOf(returnType);
7190 _name = _becomeParentOf(name); 7399 _name = _becomeParentOf(name);
7191 _typeParameters = _becomeParentOf(typeParameters); 7400 _typeParameters = _becomeParentOf(typeParameters);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
7270 7479
7271 @override 7480 @override
7272 FormalParameterList get parameters => _parameters; 7481 FormalParameterList get parameters => _parameters;
7273 7482
7274 @override 7483 @override
7275 void set parameters(FormalParameterList parameters) { 7484 void set parameters(FormalParameterList parameters) {
7276 _parameters = _becomeParentOf(parameters as AstNodeImpl); 7485 _parameters = _becomeParentOf(parameters as AstNodeImpl);
7277 } 7486 }
7278 7487
7279 @override 7488 @override
7280 TypeName get returnType => _returnType; 7489 TypeAnnotation get returnType => _returnType;
7281 7490
7282 @override 7491 @override
7283 void set returnType(TypeName typeName) { 7492 void set returnType(TypeAnnotation type) {
7284 _returnType = _becomeParentOf(typeName as AstNodeImpl); 7493 _returnType = _becomeParentOf(type as AstNodeImpl);
7285 } 7494 }
7286 7495
7287 @override 7496 @override
7288 TypeParameterList get typeParameters => _typeParameters; 7497 TypeParameterList get typeParameters => _typeParameters;
7289 7498
7290 @override 7499 @override
7291 void set typeParameters(TypeParameterList typeParameters) { 7500 void set typeParameters(TypeParameterList typeParameters) {
7292 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 7501 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
7293 } 7502 }
7294 7503
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
8984 /** 9193 /**
8985 * The token representing either the 'final', 'const' or 'var' keyword, or 9194 * The token representing either the 'final', 'const' or 'var' keyword, or
8986 * `null` if no keyword was used. 9195 * `null` if no keyword was used.
8987 */ 9196 */
8988 Token keyword; 9197 Token keyword;
8989 9198
8990 /** 9199 /**
8991 * The name of the declared type of the parameter, or `null` if the parameter 9200 * The name of the declared type of the parameter, or `null` if the parameter
8992 * does not have a declared type. 9201 * does not have a declared type.
8993 */ 9202 */
8994 TypeName _type; 9203 TypeAnnotation _type;
8995 9204
8996 /** 9205 /**
8997 * Initialize a newly created formal parameter. Either or both of the 9206 * Initialize a newly created formal parameter. Either or both of the
8998 * [comment] and [metadata] can be `null` if the parameter does not have the 9207 * [comment] and [metadata] can be `null` if the parameter does not have the
8999 * corresponding attribute. The [keyword] can be `null` if a type was 9208 * corresponding attribute. The [keyword] can be `null` if a type was
9000 * specified. The [type] must be `null` if the keyword is 'var'. 9209 * specified. The [type] must be `null` if the keyword is 'var'.
9001 */ 9210 */
9002 SimpleFormalParameterImpl(CommentImpl comment, List<Annotation> metadata, 9211 SimpleFormalParameterImpl(CommentImpl comment, List<Annotation> metadata,
9003 this.keyword, TypeNameImpl type, SimpleIdentifierImpl identifier) 9212 this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier)
9004 : super(comment, metadata, identifier) { 9213 : super(comment, metadata, identifier) {
9005 _type = _becomeParentOf(type); 9214 _type = _becomeParentOf(type);
9006 } 9215 }
9007 9216
9008 @override 9217 @override
9009 Token get beginToken { 9218 Token get beginToken {
9010 NodeList<Annotation> metadata = this.metadata; 9219 NodeList<Annotation> metadata = this.metadata;
9011 if (!metadata.isEmpty) { 9220 if (!metadata.isEmpty) {
9012 return metadata.beginToken; 9221 return metadata.beginToken;
9013 } else if (keyword != null) { 9222 } else if (keyword != null) {
(...skipping 11 matching lines...) Expand all
9025 @override 9234 @override
9026 Token get endToken => identifier.endToken; 9235 Token get endToken => identifier.endToken;
9027 9236
9028 @override 9237 @override
9029 bool get isConst => keyword?.keyword == Keyword.CONST; 9238 bool get isConst => keyword?.keyword == Keyword.CONST;
9030 9239
9031 @override 9240 @override
9032 bool get isFinal => keyword?.keyword == Keyword.FINAL; 9241 bool get isFinal => keyword?.keyword == Keyword.FINAL;
9033 9242
9034 @override 9243 @override
9035 TypeName get type => _type; 9244 TypeAnnotation get type => _type;
9036 9245
9037 @override 9246 @override
9038 void set type(TypeName typeName) { 9247 void set type(TypeAnnotation type) {
9039 _type = _becomeParentOf(typeName as AstNodeImpl); 9248 _type = _becomeParentOf(type as AstNodeImpl);
9040 } 9249 }
9041 9250
9042 @override 9251 @override
9043 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 9252 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
9044 visitor.visitSimpleFormalParameter(this); 9253 visitor.visitSimpleFormalParameter(this);
9045 9254
9046 @override 9255 @override
9047 void visitChildren(AstVisitor visitor) { 9256 void visitChildren(AstVisitor visitor) {
9048 super.visitChildren(visitor); 9257 super.visitChildren(visitor);
9049 _type?.accept(visitor); 9258 _type?.accept(visitor);
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
10292 : super(comment, metadata, name); 10501 : super(comment, metadata, name);
10293 10502
10294 @override 10503 @override
10295 Token get endToken => semicolon; 10504 Token get endToken => semicolon;
10296 10505
10297 @override 10506 @override
10298 Token get firstTokenAfterCommentAndMetadata => typedefKeyword; 10507 Token get firstTokenAfterCommentAndMetadata => typedefKeyword;
10299 } 10508 }
10300 10509
10301 /** 10510 /**
10511 * A type annotation.
10512 *
10513 * type ::=
10514 * [NamedType]
10515 * | [GenericFunctionType]
10516 */
10517 abstract class TypeAnnotationImpl extends AstNodeImpl
10518 implements TypeAnnotation {}
10519
10520 /**
10302 * A list of type arguments. 10521 * A list of type arguments.
10303 * 10522 *
10304 * typeArguments ::= 10523 * typeArguments ::=
10305 * '<' typeName (',' typeName)* '>' 10524 * '<' typeName (',' typeName)* '>'
10306 */ 10525 */
10307 class TypeArgumentListImpl extends AstNodeImpl implements TypeArgumentList { 10526 class TypeArgumentListImpl extends AstNodeImpl implements TypeArgumentList {
10308 /** 10527 /**
10309 * The left bracket. 10528 * The left bracket.
10310 */ 10529 */
10311 Token leftBracket; 10530 Token leftBracket;
10312 10531
10313 /** 10532 /**
10314 * The type arguments associated with the type. 10533 * The type arguments associated with the type.
10315 */ 10534 */
10316 NodeList<TypeName> _arguments; 10535 NodeList<TypeAnnotation> _arguments;
10317 10536
10318 /** 10537 /**
10319 * The right bracket. 10538 * The right bracket.
10320 */ 10539 */
10321 Token rightBracket; 10540 Token rightBracket;
10322 10541
10323 /** 10542 /**
10324 * Initialize a newly created list of type arguments. 10543 * Initialize a newly created list of type arguments.
10325 */ 10544 */
10326 TypeArgumentListImpl( 10545 TypeArgumentListImpl(
10327 this.leftBracket, List<TypeName> arguments, this.rightBracket) { 10546 this.leftBracket, List<TypeAnnotation> arguments, this.rightBracket) {
10328 _arguments = new NodeListImpl<TypeName>(this, arguments); 10547 _arguments = new NodeListImpl<TypeAnnotation>(this, arguments);
10329 } 10548 }
10330 10549
10331 @override 10550 @override
10332 NodeList<TypeName> get arguments => _arguments; 10551 NodeList<TypeAnnotation> get arguments => _arguments;
10333 10552
10334 @override 10553 @override
10335 Token get beginToken => leftBracket; 10554 Token get beginToken => leftBracket;
10336 10555
10337 @override 10556 @override
10338 // TODO(paulberry): Add commas. 10557 // TODO(paulberry): Add commas.
10339 Iterable<SyntacticEntity> get childEntities => new ChildEntities() 10558 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
10340 ..add(leftBracket) 10559 ..add(leftBracket)
10341 ..addAll(_arguments) 10560 ..addAll(_arguments)
10342 ..add(rightBracket); 10561 ..add(rightBracket);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
10399 _typeArguments?.accept(visitor); 10618 _typeArguments?.accept(visitor);
10400 } 10619 }
10401 } 10620 }
10402 10621
10403 /** 10622 /**
10404 * The name of a type, which can optionally include type arguments. 10623 * The name of a type, which can optionally include type arguments.
10405 * 10624 *
10406 * typeName ::= 10625 * typeName ::=
10407 * [Identifier] typeArguments? 10626 * [Identifier] typeArguments?
10408 */ 10627 */
10409 class TypeNameImpl extends AstNodeImpl implements TypeName { 10628 class TypeNameImpl extends TypeAnnotationImpl implements TypeName {
10410 /** 10629 /**
10411 * The name of the type. 10630 * The name of the type.
10412 */ 10631 */
10413 Identifier _name; 10632 Identifier _name;
10414 10633
10415 /** 10634 /**
10416 * The type arguments associated with the type, or `null` if there are no type 10635 * The type arguments associated with the type, or `null` if there are no type
10417 * arguments. 10636 * arguments.
10418 */ 10637 */
10419 TypeArgumentList _typeArguments; 10638 TypeArgumentList _typeArguments;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
10505 /** 10724 /**
10506 * The token representing the 'extends' keyword, or `null` if there is no 10725 * The token representing the 'extends' keyword, or `null` if there is no
10507 * explicit upper bound. 10726 * explicit upper bound.
10508 */ 10727 */
10509 Token extendsKeyword; 10728 Token extendsKeyword;
10510 10729
10511 /** 10730 /**
10512 * The name of the upper bound for legal arguments, or `null` if there is no 10731 * The name of the upper bound for legal arguments, or `null` if there is no
10513 * explicit upper bound. 10732 * explicit upper bound.
10514 */ 10733 */
10515 TypeName _bound; 10734 TypeAnnotation _bound;
10516 10735
10517 /** 10736 /**
10518 * Initialize a newly created type parameter. Either or both of the [comment] 10737 * Initialize a newly created type parameter. Either or both of the [comment]
10519 * and [metadata] can be `null` if the parameter does not have the 10738 * and [metadata] can be `null` if the parameter does not have the
10520 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if 10739 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
10521 * the parameter does not have an upper bound. 10740 * the parameter does not have an upper bound.
10522 */ 10741 */
10523 TypeParameterImpl(CommentImpl comment, List<Annotation> metadata, 10742 TypeParameterImpl(CommentImpl comment, List<Annotation> metadata,
10524 SimpleIdentifierImpl name, this.extendsKeyword, TypeNameImpl bound) 10743 SimpleIdentifierImpl name, this.extendsKeyword, TypeAnnotationImpl bound)
10525 : super(comment, metadata) { 10744 : super(comment, metadata) {
10526 _name = _becomeParentOf(name); 10745 _name = _becomeParentOf(name);
10527 _bound = _becomeParentOf(bound); 10746 _bound = _becomeParentOf(bound);
10528 } 10747 }
10529 10748
10530 @override 10749 @override
10531 TypeName get bound => _bound; 10750 TypeAnnotation get bound => _bound;
10532 10751
10533 @override 10752 @override
10534 void set bound(TypeName typeName) { 10753 void set bound(TypeAnnotation type) {
10535 _bound = _becomeParentOf(typeName as AstNodeImpl); 10754 _bound = _becomeParentOf(type as AstNodeImpl);
10536 } 10755 }
10537 10756
10538 @override 10757 @override
10539 Iterable<SyntacticEntity> get childEntities => 10758 Iterable<SyntacticEntity> get childEntities =>
10540 super._childEntities..add(_name)..add(extendsKeyword)..add(_bound); 10759 super._childEntities..add(_name)..add(extendsKeyword)..add(_bound);
10541 10760
10542 @override 10761 @override
10543 TypeParameterElement get element => 10762 TypeParameterElement get element =>
10544 _name?.staticElement as TypeParameterElement; 10763 _name?.staticElement as TypeParameterElement;
10545 10764
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
10883 implements VariableDeclarationList { 11102 implements VariableDeclarationList {
10884 /** 11103 /**
10885 * The token representing the 'final', 'const' or 'var' keyword, or `null` if 11104 * The token representing the 'final', 'const' or 'var' keyword, or `null` if
10886 * no keyword was included. 11105 * no keyword was included.
10887 */ 11106 */
10888 Token keyword; 11107 Token keyword;
10889 11108
10890 /** 11109 /**
10891 * The type of the variables being declared, or `null` if no type was provided . 11110 * The type of the variables being declared, or `null` if no type was provided .
10892 */ 11111 */
10893 TypeName _type; 11112 TypeAnnotation _type;
10894 11113
10895 /** 11114 /**
10896 * A list containing the individual variables being declared. 11115 * A list containing the individual variables being declared.
10897 */ 11116 */
10898 NodeList<VariableDeclaration> _variables; 11117 NodeList<VariableDeclaration> _variables;
10899 11118
10900 /** 11119 /**
10901 * Initialize a newly created variable declaration list. Either or both of the 11120 * Initialize a newly created variable declaration list. Either or both of the
10902 * [comment] and [metadata] can be `null` if the variable list does not have 11121 * [comment] and [metadata] can be `null` if the variable list does not have
10903 * the corresponding attribute. The [keyword] can be `null` if a type was 11122 * the corresponding attribute. The [keyword] can be `null` if a type was
10904 * specified. The [type] must be `null` if the keyword is 'var'. 11123 * specified. The [type] must be `null` if the keyword is 'var'.
10905 */ 11124 */
10906 VariableDeclarationListImpl(CommentImpl comment, List<Annotation> metadata, 11125 VariableDeclarationListImpl(
10907 this.keyword, TypeNameImpl type, List<VariableDeclaration> variables) 11126 CommentImpl comment,
11127 List<Annotation> metadata,
11128 this.keyword,
11129 TypeAnnotationImpl type,
11130 List<VariableDeclaration> variables)
10908 : super(comment, metadata) { 11131 : super(comment, metadata) {
10909 _type = _becomeParentOf(type); 11132 _type = _becomeParentOf(type);
10910 _variables = new NodeListImpl<VariableDeclaration>(this, variables); 11133 _variables = new NodeListImpl<VariableDeclaration>(this, variables);
10911 } 11134 }
10912 11135
10913 @override 11136 @override
10914 // TODO(paulberry): include commas. 11137 // TODO(paulberry): include commas.
10915 Iterable<SyntacticEntity> get childEntities => super._childEntities 11138 Iterable<SyntacticEntity> get childEntities => super._childEntities
10916 ..add(keyword) 11139 ..add(keyword)
10917 ..add(_type) 11140 ..add(_type)
(...skipping 12 matching lines...) Expand all
10930 return _variables.beginToken; 11153 return _variables.beginToken;
10931 } 11154 }
10932 11155
10933 @override 11156 @override
10934 bool get isConst => keyword?.keyword == Keyword.CONST; 11157 bool get isConst => keyword?.keyword == Keyword.CONST;
10935 11158
10936 @override 11159 @override
10937 bool get isFinal => keyword?.keyword == Keyword.FINAL; 11160 bool get isFinal => keyword?.keyword == Keyword.FINAL;
10938 11161
10939 @override 11162 @override
10940 TypeName get type => _type; 11163 TypeAnnotation get type => _type;
10941 11164
10942 @override 11165 @override
10943 void set type(TypeName typeName) { 11166 void set type(TypeAnnotation type) {
10944 _type = _becomeParentOf(typeName as AstNodeImpl); 11167 _type = _becomeParentOf(type as AstNodeImpl);
10945 } 11168 }
10946 11169
10947 @override 11170 @override
10948 NodeList<VariableDeclaration> get variables => _variables; 11171 NodeList<VariableDeclaration> get variables => _variables;
10949 11172
10950 @override 11173 @override
10951 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11174 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
10952 visitor.visitVariableDeclarationList(this); 11175 visitor.visitVariableDeclarationList(this);
10953 11176
10954 @override 11177 @override
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
11214 11437
11215 @override 11438 @override
11216 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11439 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11217 visitor.visitYieldStatement(this); 11440 visitor.visitYieldStatement(this);
11218 11441
11219 @override 11442 @override
11220 void visitChildren(AstVisitor visitor) { 11443 void visitChildren(AstVisitor visitor) {
11221 _expression?.accept(visitor); 11444 _expression?.accept(visitor);
11222 } 11445 }
11223 } 11446 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/ast/visitor.dart ('k') | pkg/analyzer/lib/src/dart/ast/ast_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698