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

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

Issue 2624283003: Revert "Add support for generic function type syntax, part 1" (TBR) (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 type being cast to. 507 * The name of the type being cast to.
508 */ 508 */
509 TypeAnnotation _type; 509 TypeName _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, TypeAnnotationImpl type) { 515 ExpressionImpl expression, this.asOperator, TypeNameImpl 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 TypeAnnotation get type => _type; 542 TypeName get type => _type;
543 543
544 @override 544 @override
545 void set type(TypeAnnotation type) { 545 void set type(TypeName name) {
546 _type = _becomeParentOf(type as AstNodeImpl); 546 _type = _becomeParentOf(name 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 TypeAnnotation _exceptionType; 1578 TypeName _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 TypeAnnotationImpl exceptionType, 1631 TypeNameImpl 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 TypeAnnotation get exceptionType => _exceptionType; 1685 TypeName get exceptionType => _exceptionType;
1686 1686
1687 @override 1687 @override
1688 void set exceptionType(TypeAnnotation exceptionType) { 1688 void set exceptionType(TypeName 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 TypeAnnotation _type; 3297 TypeName _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, TypeAnnotationImpl type, SimpleIdentifierImpl identifier) 3311 this.keyword, TypeNameImpl 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 TypeAnnotation get type => _type; 3357 TypeName get type => _type;
3358 3358
3359 @override 3359 @override
3360 void set type(TypeAnnotation type) { 3360 void set type(TypeName typeName) {
3361 _type = _becomeParentOf(type as AstNodeImpl); 3361 _type = _becomeParentOf(typeName 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 TypeAnnotation _type; 4411 TypeName _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 TypeAnnotationImpl type, 4450 TypeNameImpl 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 TypeAnnotation get type => _type; 4504 TypeName get type => _type;
4505 4505
4506 @override 4506 @override
4507 void set type(TypeAnnotation type) { 4507 void set type(TypeName typeName) {
4508 _type = _becomeParentOf(type as AstNodeImpl); 4508 _type = _becomeParentOf(typeName 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 TypeAnnotation _returnType; 5087 TypeName _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 TypeAnnotationImpl returnType, 5113 TypeNameImpl 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 TypeAnnotation get returnType => _returnType; 5165 TypeName get returnType => _returnType;
5166 5166
5167 @override 5167 @override
5168 void set returnType(TypeAnnotation type) { 5168 void set returnType(TypeName returnType) {
5169 _returnType = _becomeParentOf(type as AstNodeImpl); 5169 _returnType = _becomeParentOf(returnType 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( 5198 FunctionDeclarationStatementImpl(FunctionDeclaration functionDeclaration) {
5199 FunctionDeclarationImpl functionDeclaration) { 5199 _functionDeclaration = _becomeParentOf(functionDeclaration as AstNodeImpl);
5200 _functionDeclaration = _becomeParentOf(functionDeclaration);
5201 } 5200 }
5202 5201
5203 @override 5202 @override
5204 Token get beginToken => _functionDeclaration.beginToken; 5203 Token get beginToken => _functionDeclaration.beginToken;
5205 5204
5206 @override 5205 @override
5207 Iterable<SyntacticEntity> get childEntities => 5206 Iterable<SyntacticEntity> get childEntities =>
5208 new ChildEntities()..add(_functionDeclaration); 5207 new ChildEntities()..add(_functionDeclaration);
5209 5208
5210 @override 5209 @override
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 * functionPrefix [TypeParameterList]? [FormalParameterList] ';' 5427 * functionPrefix [TypeParameterList]? [FormalParameterList] ';'
5429 * 5428 *
5430 * functionPrefix ::= 5429 * functionPrefix ::=
5431 * [TypeName]? [SimpleIdentifier] 5430 * [TypeName]? [SimpleIdentifier]
5432 */ 5431 */
5433 class FunctionTypeAliasImpl extends TypeAliasImpl implements FunctionTypeAlias { 5432 class FunctionTypeAliasImpl extends TypeAliasImpl implements FunctionTypeAlias {
5434 /** 5433 /**
5435 * The name of the return type of the function type being defined, or `null` 5434 * The name of the return type of the function type being defined, or `null`
5436 * if no return type was given. 5435 * if no return type was given.
5437 */ 5436 */
5438 TypeAnnotation _returnType; 5437 TypeName _returnType;
5439 5438
5440 /** 5439 /**
5441 * The type parameters for the function type, or `null` if the function type 5440 * The type parameters for the function type, or `null` if the function type
5442 * does not have any type parameters. 5441 * does not have any type parameters.
5443 */ 5442 */
5444 TypeParameterList _typeParameters; 5443 TypeParameterList _typeParameters;
5445 5444
5446 /** 5445 /**
5447 * The parameters associated with the function type. 5446 * The parameters associated with the function type.
5448 */ 5447 */
5449 FormalParameterList _parameters; 5448 FormalParameterList _parameters;
5450 5449
5451 /** 5450 /**
5452 * Initialize a newly created function type alias. Either or both of the 5451 * Initialize a newly created function type alias. Either or both of the
5453 * [comment] and [metadata] can be `null` if the function does not have the 5452 * [comment] and [metadata] can be `null` if the function does not have the
5454 * corresponding attribute. The [returnType] can be `null` if no return type 5453 * corresponding attribute. The [returnType] can be `null` if no return type
5455 * was specified. The [typeParameters] can be `null` if the function has no 5454 * was specified. The [typeParameters] can be `null` if the function has no
5456 * type parameters. 5455 * type parameters.
5457 */ 5456 */
5458 FunctionTypeAliasImpl( 5457 FunctionTypeAliasImpl(
5459 CommentImpl comment, 5458 CommentImpl comment,
5460 List<Annotation> metadata, 5459 List<Annotation> metadata,
5461 Token keyword, 5460 Token keyword,
5462 TypeAnnotationImpl returnType, 5461 TypeNameImpl returnType,
5463 SimpleIdentifierImpl name, 5462 SimpleIdentifierImpl name,
5464 TypeParameterListImpl typeParameters, 5463 TypeParameterListImpl typeParameters,
5465 FormalParameterListImpl parameters, 5464 FormalParameterListImpl parameters,
5466 Token semicolon) 5465 Token semicolon)
5467 : super(comment, metadata, keyword, name, semicolon) { 5466 : super(comment, metadata, keyword, name, semicolon) {
5468 _returnType = _becomeParentOf(returnType); 5467 _returnType = _becomeParentOf(returnType);
5469 _typeParameters = _becomeParentOf(typeParameters); 5468 _typeParameters = _becomeParentOf(typeParameters);
5470 _parameters = _becomeParentOf(parameters); 5469 _parameters = _becomeParentOf(parameters);
5471 } 5470 }
5472 5471
(...skipping 12 matching lines...) Expand all
5485 5484
5486 @override 5485 @override
5487 FormalParameterList get parameters => _parameters; 5486 FormalParameterList get parameters => _parameters;
5488 5487
5489 @override 5488 @override
5490 void set parameters(FormalParameterList parameters) { 5489 void set parameters(FormalParameterList parameters) {
5491 _parameters = _becomeParentOf(parameters as AstNodeImpl); 5490 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5492 } 5491 }
5493 5492
5494 @override 5493 @override
5495 TypeAnnotation get returnType => _returnType; 5494 TypeName get returnType => _returnType;
5496 5495
5497 @override 5496 @override
5498 void set returnType(TypeAnnotation type) { 5497 void set returnType(TypeName typeName) {
5499 _returnType = _becomeParentOf(type as AstNodeImpl); 5498 _returnType = _becomeParentOf(typeName as AstNodeImpl);
5500 } 5499 }
5501 5500
5502 @override 5501 @override
5503 TypeParameterList get typeParameters => _typeParameters; 5502 TypeParameterList get typeParameters => _typeParameters;
5504 5503
5505 @override 5504 @override
5506 void set typeParameters(TypeParameterList typeParameters) { 5505 void set typeParameters(TypeParameterList typeParameters) {
5507 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 5506 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5508 } 5507 }
5509 5508
(...skipping 16 matching lines...) Expand all
5526 * 5525 *
5527 * functionSignature ::= 5526 * functionSignature ::=
5528 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st] 5527 * [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterLi st]
5529 */ 5528 */
5530 class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl 5529 class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl
5531 implements FunctionTypedFormalParameter { 5530 implements FunctionTypedFormalParameter {
5532 /** 5531 /**
5533 * The return type of the function, or `null` if the function does not have a 5532 * The return type of the function, or `null` if the function does not have a
5534 * return type. 5533 * return type.
5535 */ 5534 */
5536 TypeAnnotation _returnType; 5535 TypeName _returnType;
5537 5536
5538 /** 5537 /**
5539 * The type parameters associated with the function, or `null` if the function 5538 * The type parameters associated with the function, or `null` if the function
5540 * is not a generic function. 5539 * is not a generic function.
5541 */ 5540 */
5542 TypeParameterList _typeParameters; 5541 TypeParameterList _typeParameters;
5543 5542
5544 /** 5543 /**
5545 * The parameters of the function-typed parameter. 5544 * The parameters of the function-typed parameter.
5546 */ 5545 */
5547 FormalParameterList _parameters; 5546 FormalParameterList _parameters;
5548 5547
5549 @override 5548 @override
5550 Token question; 5549 Token question;
5551 5550
5552 /** 5551 /**
5553 * Initialize a newly created formal parameter. Either or both of the 5552 * Initialize a newly created formal parameter. Either or both of the
5554 * [comment] and [metadata] can be `null` if the parameter does not have the 5553 * [comment] and [metadata] can be `null` if the parameter does not have the
5555 * corresponding attribute. The [returnType] can be `null` if no return type 5554 * corresponding attribute. The [returnType] can be `null` if no return type
5556 * was specified. 5555 * was specified.
5557 */ 5556 */
5558 FunctionTypedFormalParameterImpl( 5557 FunctionTypedFormalParameterImpl(
5559 CommentImpl comment, 5558 CommentImpl comment,
5560 List<Annotation> metadata, 5559 List<Annotation> metadata,
5561 TypeAnnotationImpl returnType, 5560 TypeNameImpl returnType,
5562 SimpleIdentifierImpl identifier, 5561 SimpleIdentifierImpl identifier,
5563 TypeParameterListImpl typeParameters, 5562 TypeParameterListImpl typeParameters,
5564 FormalParameterListImpl parameters, 5563 FormalParameterListImpl parameters,
5565 this.question) 5564 this.question)
5566 : super(comment, metadata, identifier) { 5565 : super(comment, metadata, identifier) {
5567 _returnType = _becomeParentOf(returnType); 5566 _returnType = _becomeParentOf(returnType);
5568 _typeParameters = _becomeParentOf(typeParameters); 5567 _typeParameters = _becomeParentOf(typeParameters);
5569 _parameters = _becomeParentOf(parameters); 5568 _parameters = _becomeParentOf(parameters);
5570 } 5569 }
5571 5570
(...skipping 20 matching lines...) Expand all
5592 5591
5593 @override 5592 @override
5594 FormalParameterList get parameters => _parameters; 5593 FormalParameterList get parameters => _parameters;
5595 5594
5596 @override 5595 @override
5597 void set parameters(FormalParameterList parameters) { 5596 void set parameters(FormalParameterList parameters) {
5598 _parameters = _becomeParentOf(parameters as AstNodeImpl); 5597 _parameters = _becomeParentOf(parameters as AstNodeImpl);
5599 } 5598 }
5600 5599
5601 @override 5600 @override
5602 TypeAnnotation get returnType => _returnType; 5601 TypeName get returnType => _returnType;
5603 5602
5604 @override 5603 @override
5605 void set returnType(TypeAnnotation type) { 5604 void set returnType(TypeName type) {
5606 _returnType = _becomeParentOf(type as AstNodeImpl); 5605 _returnType = _becomeParentOf(type as AstNodeImpl);
5607 } 5606 }
5608 5607
5609 @override 5608 @override
5610 TypeParameterList get typeParameters => _typeParameters; 5609 TypeParameterList get typeParameters => _typeParameters;
5611 5610
5612 @override 5611 @override
5613 void set typeParameters(TypeParameterList typeParameters) { 5612 void set typeParameters(TypeParameterList typeParameters) {
5614 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 5613 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
5615 } 5614 }
5616 5615
5617 @override 5616 @override
5618 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 5617 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
5619 visitor.visitFunctionTypedFormalParameter(this); 5618 visitor.visitFunctionTypedFormalParameter(this);
5620 5619
5621 @override 5620 @override
5622 void visitChildren(AstVisitor visitor) { 5621 void visitChildren(AstVisitor visitor) {
5623 super.visitChildren(visitor); 5622 super.visitChildren(visitor);
5624 _returnType?.accept(visitor); 5623 _returnType?.accept(visitor);
5625 identifier?.accept(visitor); 5624 identifier?.accept(visitor);
5626 _typeParameters?.accept(visitor); 5625 _typeParameters?.accept(visitor);
5627 _parameters?.accept(visitor); 5626 _parameters?.accept(visitor);
5628 } 5627 }
5629 } 5628 }
5630 5629
5631 /** 5630 /**
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 /**
5840 * A combinator that restricts the names being imported to those that are not in 5631 * A combinator that restricts the names being imported to those that are not in
5841 * a given list. 5632 * a given list.
5842 * 5633 *
5843 * hideCombinator ::= 5634 * hideCombinator ::=
5844 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* 5635 * 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])*
5845 */ 5636 */
5846 class HideCombinatorImpl extends CombinatorImpl implements HideCombinator { 5637 class HideCombinatorImpl extends CombinatorImpl implements HideCombinator {
5847 /** 5638 /**
5848 * The list of names from the library that are hidden by this combinator. 5639 * The list of names from the library that are hidden by this combinator.
5849 */ 5640 */
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6729 6520
6730 /** 6521 /**
6731 * The not operator, or `null` if the sense of the test is not negated. 6522 * The not operator, or `null` if the sense of the test is not negated.
6732 */ 6523 */
6733 @override 6524 @override
6734 Token notOperator; 6525 Token notOperator;
6735 6526
6736 /** 6527 /**
6737 * The name of the type being tested for. 6528 * The name of the type being tested for.
6738 */ 6529 */
6739 TypeAnnotation _type; 6530 TypeName _type;
6740 6531
6741 /** 6532 /**
6742 * Initialize a newly created is expression. The [notOperator] can be `null` 6533 * Initialize a newly created is expression. The [notOperator] can be `null`
6743 * if the sense of the test is not negated. 6534 * if the sense of the test is not negated.
6744 */ 6535 */
6745 IsExpressionImpl(ExpressionImpl expression, this.isOperator, this.notOperator, 6536 IsExpressionImpl(ExpressionImpl expression, this.isOperator, this.notOperator,
6746 TypeAnnotationImpl type) { 6537 TypeNameImpl type) {
6747 _expression = _becomeParentOf(expression); 6538 _expression = _becomeParentOf(expression);
6748 _type = _becomeParentOf(type); 6539 _type = _becomeParentOf(type);
6749 } 6540 }
6750 6541
6751 @override 6542 @override
6752 Token get beginToken => _expression.beginToken; 6543 Token get beginToken => _expression.beginToken;
6753 6544
6754 @override 6545 @override
6755 Iterable<SyntacticEntity> get childEntities => new ChildEntities() 6546 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
6756 ..add(_expression) 6547 ..add(_expression)
6757 ..add(isOperator) 6548 ..add(isOperator)
6758 ..add(notOperator) 6549 ..add(notOperator)
6759 ..add(_type); 6550 ..add(_type);
6760 6551
6761 @override 6552 @override
6762 Token get endToken => _type.endToken; 6553 Token get endToken => _type.endToken;
6763 6554
6764 @override 6555 @override
6765 Expression get expression => _expression; 6556 Expression get expression => _expression;
6766 6557
6767 @override 6558 @override
6768 void set expression(Expression expression) { 6559 void set expression(Expression expression) {
6769 _expression = _becomeParentOf(expression as AstNodeImpl); 6560 _expression = _becomeParentOf(expression as AstNodeImpl);
6770 } 6561 }
6771 6562
6772 @override 6563 @override
6773 int get precedence => 7; 6564 int get precedence => 7;
6774 6565
6775 @override 6566 @override
6776 TypeAnnotation get type => _type; 6567 TypeName get type => _type;
6777 6568
6778 @override 6569 @override
6779 void set type(TypeAnnotation type) { 6570 void set type(TypeName name) {
6780 _type = _becomeParentOf(type as AstNodeImpl); 6571 _type = _becomeParentOf(name as AstNodeImpl);
6781 } 6572 }
6782 6573
6783 @override 6574 @override
6784 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 6575 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
6785 visitor.visitIsExpression(this); 6576 visitor.visitIsExpression(this);
6786 6577
6787 @override 6578 @override
6788 void visitChildren(AstVisitor visitor) { 6579 void visitChildren(AstVisitor visitor) {
6789 _expression?.accept(visitor); 6580 _expression?.accept(visitor);
6790 _type?.accept(visitor); 6581 _type?.accept(visitor);
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
7326 /** 7117 /**
7327 * The token representing the 'abstract' or 'static' keyword, or `null` if 7118 * The token representing the 'abstract' or 'static' keyword, or `null` if
7328 * neither modifier was specified. 7119 * neither modifier was specified.
7329 */ 7120 */
7330 @override 7121 @override
7331 Token modifierKeyword; 7122 Token modifierKeyword;
7332 7123
7333 /** 7124 /**
7334 * The return type of the method, or `null` if no return type was declared. 7125 * The return type of the method, or `null` if no return type was declared.
7335 */ 7126 */
7336 TypeAnnotation _returnType; 7127 TypeName _returnType;
7337 7128
7338 /** 7129 /**
7339 * The token representing the 'get' or 'set' keyword, or `null` if this is a 7130 * The token representing the 'get' or 'set' keyword, or `null` if this is a
7340 * method declaration rather than a property declaration. 7131 * method declaration rather than a property declaration.
7341 */ 7132 */
7342 @override 7133 @override
7343 Token propertyKeyword; 7134 Token propertyKeyword;
7344 7135
7345 /** 7136 /**
7346 * The token representing the 'operator' keyword, or `null` if this method 7137 * The token representing the 'operator' keyword, or `null` if this method
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
7380 * type was specified. The [propertyKeyword] can be `null` if the method is 7171 * type was specified. The [propertyKeyword] can be `null` if the method is
7381 * neither a getter or a setter. The [operatorKeyword] can be `null` if the 7172 * neither a getter or a setter. The [operatorKeyword] can be `null` if the
7382 * method does not implement an operator. The [parameters] must be `null` if 7173 * method does not implement an operator. The [parameters] must be `null` if
7383 * this method declares a getter. 7174 * this method declares a getter.
7384 */ 7175 */
7385 MethodDeclarationImpl( 7176 MethodDeclarationImpl(
7386 CommentImpl comment, 7177 CommentImpl comment,
7387 List<Annotation> metadata, 7178 List<Annotation> metadata,
7388 this.externalKeyword, 7179 this.externalKeyword,
7389 this.modifierKeyword, 7180 this.modifierKeyword,
7390 TypeAnnotationImpl returnType, 7181 TypeNameImpl returnType,
7391 this.propertyKeyword, 7182 this.propertyKeyword,
7392 this.operatorKeyword, 7183 this.operatorKeyword,
7393 SimpleIdentifierImpl name, 7184 SimpleIdentifierImpl name,
7394 TypeParameterListImpl typeParameters, 7185 TypeParameterListImpl typeParameters,
7395 FormalParameterListImpl parameters, 7186 FormalParameterListImpl parameters,
7396 FunctionBodyImpl body) 7187 FunctionBodyImpl body)
7397 : super(comment, metadata) { 7188 : super(comment, metadata) {
7398 _returnType = _becomeParentOf(returnType); 7189 _returnType = _becomeParentOf(returnType);
7399 _name = _becomeParentOf(name); 7190 _name = _becomeParentOf(name);
7400 _typeParameters = _becomeParentOf(typeParameters); 7191 _typeParameters = _becomeParentOf(typeParameters);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
7479 7270
7480 @override 7271 @override
7481 FormalParameterList get parameters => _parameters; 7272 FormalParameterList get parameters => _parameters;
7482 7273
7483 @override 7274 @override
7484 void set parameters(FormalParameterList parameters) { 7275 void set parameters(FormalParameterList parameters) {
7485 _parameters = _becomeParentOf(parameters as AstNodeImpl); 7276 _parameters = _becomeParentOf(parameters as AstNodeImpl);
7486 } 7277 }
7487 7278
7488 @override 7279 @override
7489 TypeAnnotation get returnType => _returnType; 7280 TypeName get returnType => _returnType;
7490 7281
7491 @override 7282 @override
7492 void set returnType(TypeAnnotation type) { 7283 void set returnType(TypeName typeName) {
7493 _returnType = _becomeParentOf(type as AstNodeImpl); 7284 _returnType = _becomeParentOf(typeName as AstNodeImpl);
7494 } 7285 }
7495 7286
7496 @override 7287 @override
7497 TypeParameterList get typeParameters => _typeParameters; 7288 TypeParameterList get typeParameters => _typeParameters;
7498 7289
7499 @override 7290 @override
7500 void set typeParameters(TypeParameterList typeParameters) { 7291 void set typeParameters(TypeParameterList typeParameters) {
7501 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl); 7292 _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
7502 } 7293 }
7503 7294
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
9193 /** 8984 /**
9194 * The token representing either the 'final', 'const' or 'var' keyword, or 8985 * The token representing either the 'final', 'const' or 'var' keyword, or
9195 * `null` if no keyword was used. 8986 * `null` if no keyword was used.
9196 */ 8987 */
9197 Token keyword; 8988 Token keyword;
9198 8989
9199 /** 8990 /**
9200 * The name of the declared type of the parameter, or `null` if the parameter 8991 * The name of the declared type of the parameter, or `null` if the parameter
9201 * does not have a declared type. 8992 * does not have a declared type.
9202 */ 8993 */
9203 TypeAnnotation _type; 8994 TypeName _type;
9204 8995
9205 /** 8996 /**
9206 * Initialize a newly created formal parameter. Either or both of the 8997 * Initialize a newly created formal parameter. Either or both of the
9207 * [comment] and [metadata] can be `null` if the parameter does not have the 8998 * [comment] and [metadata] can be `null` if the parameter does not have the
9208 * corresponding attribute. The [keyword] can be `null` if a type was 8999 * corresponding attribute. The [keyword] can be `null` if a type was
9209 * specified. The [type] must be `null` if the keyword is 'var'. 9000 * specified. The [type] must be `null` if the keyword is 'var'.
9210 */ 9001 */
9211 SimpleFormalParameterImpl(CommentImpl comment, List<Annotation> metadata, 9002 SimpleFormalParameterImpl(CommentImpl comment, List<Annotation> metadata,
9212 this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier) 9003 this.keyword, TypeNameImpl type, SimpleIdentifierImpl identifier)
9213 : super(comment, metadata, identifier) { 9004 : super(comment, metadata, identifier) {
9214 _type = _becomeParentOf(type); 9005 _type = _becomeParentOf(type);
9215 } 9006 }
9216 9007
9217 @override 9008 @override
9218 Token get beginToken { 9009 Token get beginToken {
9219 NodeList<Annotation> metadata = this.metadata; 9010 NodeList<Annotation> metadata = this.metadata;
9220 if (!metadata.isEmpty) { 9011 if (!metadata.isEmpty) {
9221 return metadata.beginToken; 9012 return metadata.beginToken;
9222 } else if (keyword != null) { 9013 } else if (keyword != null) {
(...skipping 11 matching lines...) Expand all
9234 @override 9025 @override
9235 Token get endToken => identifier.endToken; 9026 Token get endToken => identifier.endToken;
9236 9027
9237 @override 9028 @override
9238 bool get isConst => keyword?.keyword == Keyword.CONST; 9029 bool get isConst => keyword?.keyword == Keyword.CONST;
9239 9030
9240 @override 9031 @override
9241 bool get isFinal => keyword?.keyword == Keyword.FINAL; 9032 bool get isFinal => keyword?.keyword == Keyword.FINAL;
9242 9033
9243 @override 9034 @override
9244 TypeAnnotation get type => _type; 9035 TypeName get type => _type;
9245 9036
9246 @override 9037 @override
9247 void set type(TypeAnnotation type) { 9038 void set type(TypeName typeName) {
9248 _type = _becomeParentOf(type as AstNodeImpl); 9039 _type = _becomeParentOf(typeName as AstNodeImpl);
9249 } 9040 }
9250 9041
9251 @override 9042 @override
9252 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 9043 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
9253 visitor.visitSimpleFormalParameter(this); 9044 visitor.visitSimpleFormalParameter(this);
9254 9045
9255 @override 9046 @override
9256 void visitChildren(AstVisitor visitor) { 9047 void visitChildren(AstVisitor visitor) {
9257 super.visitChildren(visitor); 9048 super.visitChildren(visitor);
9258 _type?.accept(visitor); 9049 _type?.accept(visitor);
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
10501 : super(comment, metadata, name); 10292 : super(comment, metadata, name);
10502 10293
10503 @override 10294 @override
10504 Token get endToken => semicolon; 10295 Token get endToken => semicolon;
10505 10296
10506 @override 10297 @override
10507 Token get firstTokenAfterCommentAndMetadata => typedefKeyword; 10298 Token get firstTokenAfterCommentAndMetadata => typedefKeyword;
10508 } 10299 }
10509 10300
10510 /** 10301 /**
10511 * A type annotation.
10512 *
10513 * type ::=
10514 * [NamedType]
10515 * | [GenericFunctionType]
10516 */
10517 abstract class TypeAnnotationImpl extends AstNodeImpl
10518 implements TypeAnnotation {}
10519
10520 /**
10521 * A list of type arguments. 10302 * A list of type arguments.
10522 * 10303 *
10523 * typeArguments ::= 10304 * typeArguments ::=
10524 * '<' typeName (',' typeName)* '>' 10305 * '<' typeName (',' typeName)* '>'
10525 */ 10306 */
10526 class TypeArgumentListImpl extends AstNodeImpl implements TypeArgumentList { 10307 class TypeArgumentListImpl extends AstNodeImpl implements TypeArgumentList {
10527 /** 10308 /**
10528 * The left bracket. 10309 * The left bracket.
10529 */ 10310 */
10530 Token leftBracket; 10311 Token leftBracket;
10531 10312
10532 /** 10313 /**
10533 * The type arguments associated with the type. 10314 * The type arguments associated with the type.
10534 */ 10315 */
10535 NodeList<TypeAnnotation> _arguments; 10316 NodeList<TypeName> _arguments;
10536 10317
10537 /** 10318 /**
10538 * The right bracket. 10319 * The right bracket.
10539 */ 10320 */
10540 Token rightBracket; 10321 Token rightBracket;
10541 10322
10542 /** 10323 /**
10543 * Initialize a newly created list of type arguments. 10324 * Initialize a newly created list of type arguments.
10544 */ 10325 */
10545 TypeArgumentListImpl( 10326 TypeArgumentListImpl(
10546 this.leftBracket, List<TypeAnnotation> arguments, this.rightBracket) { 10327 this.leftBracket, List<TypeName> arguments, this.rightBracket) {
10547 _arguments = new NodeListImpl<TypeAnnotation>(this, arguments); 10328 _arguments = new NodeListImpl<TypeName>(this, arguments);
10548 } 10329 }
10549 10330
10550 @override 10331 @override
10551 NodeList<TypeAnnotation> get arguments => _arguments; 10332 NodeList<TypeName> get arguments => _arguments;
10552 10333
10553 @override 10334 @override
10554 Token get beginToken => leftBracket; 10335 Token get beginToken => leftBracket;
10555 10336
10556 @override 10337 @override
10557 // TODO(paulberry): Add commas. 10338 // TODO(paulberry): Add commas.
10558 Iterable<SyntacticEntity> get childEntities => new ChildEntities() 10339 Iterable<SyntacticEntity> get childEntities => new ChildEntities()
10559 ..add(leftBracket) 10340 ..add(leftBracket)
10560 ..addAll(_arguments) 10341 ..addAll(_arguments)
10561 ..add(rightBracket); 10342 ..add(rightBracket);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
10618 _typeArguments?.accept(visitor); 10399 _typeArguments?.accept(visitor);
10619 } 10400 }
10620 } 10401 }
10621 10402
10622 /** 10403 /**
10623 * The name of a type, which can optionally include type arguments. 10404 * The name of a type, which can optionally include type arguments.
10624 * 10405 *
10625 * typeName ::= 10406 * typeName ::=
10626 * [Identifier] typeArguments? 10407 * [Identifier] typeArguments?
10627 */ 10408 */
10628 class TypeNameImpl extends TypeAnnotationImpl implements TypeName { 10409 class TypeNameImpl extends AstNodeImpl implements TypeName {
10629 /** 10410 /**
10630 * The name of the type. 10411 * The name of the type.
10631 */ 10412 */
10632 Identifier _name; 10413 Identifier _name;
10633 10414
10634 /** 10415 /**
10635 * The type arguments associated with the type, or `null` if there are no type 10416 * The type arguments associated with the type, or `null` if there are no type
10636 * arguments. 10417 * arguments.
10637 */ 10418 */
10638 TypeArgumentList _typeArguments; 10419 TypeArgumentList _typeArguments;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
10724 /** 10505 /**
10725 * The token representing the 'extends' keyword, or `null` if there is no 10506 * The token representing the 'extends' keyword, or `null` if there is no
10726 * explicit upper bound. 10507 * explicit upper bound.
10727 */ 10508 */
10728 Token extendsKeyword; 10509 Token extendsKeyword;
10729 10510
10730 /** 10511 /**
10731 * The name of the upper bound for legal arguments, or `null` if there is no 10512 * The name of the upper bound for legal arguments, or `null` if there is no
10732 * explicit upper bound. 10513 * explicit upper bound.
10733 */ 10514 */
10734 TypeAnnotation _bound; 10515 TypeName _bound;
10735 10516
10736 /** 10517 /**
10737 * Initialize a newly created type parameter. Either or both of the [comment] 10518 * Initialize a newly created type parameter. Either or both of the [comment]
10738 * and [metadata] can be `null` if the parameter does not have the 10519 * and [metadata] can be `null` if the parameter does not have the
10739 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if 10520 * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
10740 * the parameter does not have an upper bound. 10521 * the parameter does not have an upper bound.
10741 */ 10522 */
10742 TypeParameterImpl(CommentImpl comment, List<Annotation> metadata, 10523 TypeParameterImpl(CommentImpl comment, List<Annotation> metadata,
10743 SimpleIdentifierImpl name, this.extendsKeyword, TypeAnnotationImpl bound) 10524 SimpleIdentifierImpl name, this.extendsKeyword, TypeNameImpl bound)
10744 : super(comment, metadata) { 10525 : super(comment, metadata) {
10745 _name = _becomeParentOf(name); 10526 _name = _becomeParentOf(name);
10746 _bound = _becomeParentOf(bound); 10527 _bound = _becomeParentOf(bound);
10747 } 10528 }
10748 10529
10749 @override 10530 @override
10750 TypeAnnotation get bound => _bound; 10531 TypeName get bound => _bound;
10751 10532
10752 @override 10533 @override
10753 void set bound(TypeAnnotation type) { 10534 void set bound(TypeName typeName) {
10754 _bound = _becomeParentOf(type as AstNodeImpl); 10535 _bound = _becomeParentOf(typeName as AstNodeImpl);
10755 } 10536 }
10756 10537
10757 @override 10538 @override
10758 Iterable<SyntacticEntity> get childEntities => 10539 Iterable<SyntacticEntity> get childEntities =>
10759 super._childEntities..add(_name)..add(extendsKeyword)..add(_bound); 10540 super._childEntities..add(_name)..add(extendsKeyword)..add(_bound);
10760 10541
10761 @override 10542 @override
10762 TypeParameterElement get element => 10543 TypeParameterElement get element =>
10763 _name?.staticElement as TypeParameterElement; 10544 _name?.staticElement as TypeParameterElement;
10764 10545
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
11102 implements VariableDeclarationList { 10883 implements VariableDeclarationList {
11103 /** 10884 /**
11104 * The token representing the 'final', 'const' or 'var' keyword, or `null` if 10885 * The token representing the 'final', 'const' or 'var' keyword, or `null` if
11105 * no keyword was included. 10886 * no keyword was included.
11106 */ 10887 */
11107 Token keyword; 10888 Token keyword;
11108 10889
11109 /** 10890 /**
11110 * The type of the variables being declared, or `null` if no type was provided . 10891 * The type of the variables being declared, or `null` if no type was provided .
11111 */ 10892 */
11112 TypeAnnotation _type; 10893 TypeName _type;
11113 10894
11114 /** 10895 /**
11115 * A list containing the individual variables being declared. 10896 * A list containing the individual variables being declared.
11116 */ 10897 */
11117 NodeList<VariableDeclaration> _variables; 10898 NodeList<VariableDeclaration> _variables;
11118 10899
11119 /** 10900 /**
11120 * Initialize a newly created variable declaration list. Either or both of the 10901 * Initialize a newly created variable declaration list. Either or both of the
11121 * [comment] and [metadata] can be `null` if the variable list does not have 10902 * [comment] and [metadata] can be `null` if the variable list does not have
11122 * the corresponding attribute. The [keyword] can be `null` if a type was 10903 * the corresponding attribute. The [keyword] can be `null` if a type was
11123 * specified. The [type] must be `null` if the keyword is 'var'. 10904 * specified. The [type] must be `null` if the keyword is 'var'.
11124 */ 10905 */
11125 VariableDeclarationListImpl( 10906 VariableDeclarationListImpl(CommentImpl comment, List<Annotation> metadata,
11126 CommentImpl comment, 10907 this.keyword, TypeNameImpl type, List<VariableDeclaration> variables)
11127 List<Annotation> metadata,
11128 this.keyword,
11129 TypeAnnotationImpl type,
11130 List<VariableDeclaration> variables)
11131 : super(comment, metadata) { 10908 : super(comment, metadata) {
11132 _type = _becomeParentOf(type); 10909 _type = _becomeParentOf(type);
11133 _variables = new NodeListImpl<VariableDeclaration>(this, variables); 10910 _variables = new NodeListImpl<VariableDeclaration>(this, variables);
11134 } 10911 }
11135 10912
11136 @override 10913 @override
11137 // TODO(paulberry): include commas. 10914 // TODO(paulberry): include commas.
11138 Iterable<SyntacticEntity> get childEntities => super._childEntities 10915 Iterable<SyntacticEntity> get childEntities => super._childEntities
11139 ..add(keyword) 10916 ..add(keyword)
11140 ..add(_type) 10917 ..add(_type)
(...skipping 12 matching lines...) Expand all
11153 return _variables.beginToken; 10930 return _variables.beginToken;
11154 } 10931 }
11155 10932
11156 @override 10933 @override
11157 bool get isConst => keyword?.keyword == Keyword.CONST; 10934 bool get isConst => keyword?.keyword == Keyword.CONST;
11158 10935
11159 @override 10936 @override
11160 bool get isFinal => keyword?.keyword == Keyword.FINAL; 10937 bool get isFinal => keyword?.keyword == Keyword.FINAL;
11161 10938
11162 @override 10939 @override
11163 TypeAnnotation get type => _type; 10940 TypeName get type => _type;
11164 10941
11165 @override 10942 @override
11166 void set type(TypeAnnotation type) { 10943 void set type(TypeName typeName) {
11167 _type = _becomeParentOf(type as AstNodeImpl); 10944 _type = _becomeParentOf(typeName as AstNodeImpl);
11168 } 10945 }
11169 10946
11170 @override 10947 @override
11171 NodeList<VariableDeclaration> get variables => _variables; 10948 NodeList<VariableDeclaration> get variables => _variables;
11172 10949
11173 @override 10950 @override
11174 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 10951 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11175 visitor.visitVariableDeclarationList(this); 10952 visitor.visitVariableDeclarationList(this);
11176 10953
11177 @override 10954 @override
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
11437 11214
11438 @override 11215 @override
11439 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11216 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11440 visitor.visitYieldStatement(this); 11217 visitor.visitYieldStatement(this);
11441 11218
11442 @override 11219 @override
11443 void visitChildren(AstVisitor visitor) { 11220 void visitChildren(AstVisitor visitor) {
11444 _expression?.accept(visitor); 11221 _expression?.accept(visitor);
11445 } 11222 }
11446 } 11223 }
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