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

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

Issue 1934153002: Remove a cast by creating node lists directly (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 25 matching lines...) Expand all
36 /** 36 /**
37 * The strings that are implicitly concatenated. 37 * The strings that are implicitly concatenated.
38 */ 38 */
39 NodeList<StringLiteral> _strings; 39 NodeList<StringLiteral> _strings;
40 40
41 /** 41 /**
42 * Initialize a newly created list of adjacent strings. To be syntactically 42 * Initialize a newly created list of adjacent strings. To be syntactically
43 * valid, the list of [strings] must contain at least two elements. 43 * valid, the list of [strings] must contain at least two elements.
44 */ 44 */
45 AdjacentStringsImpl(List<StringLiteral> strings) { 45 AdjacentStringsImpl(List<StringLiteral> strings) {
46 _strings = new NodeList<StringLiteral>(this, strings); 46 _strings = new NodeListImpl<StringLiteral>(this, strings);
47 } 47 }
48 48
49 @override 49 @override
50 Token get beginToken => _strings.beginToken; 50 Token get beginToken => _strings.beginToken;
51 51
52 @override 52 @override
53 Iterable get childEntities => new ChildEntities()..addAll(_strings); 53 Iterable get childEntities => new ChildEntities()..addAll(_strings);
54 54
55 @override 55 @override
56 Token get endToken => _strings.endToken; 56 Token get endToken => _strings.endToken;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 */ 91 */
92 NodeList<Annotation> _metadata; 92 NodeList<Annotation> _metadata;
93 93
94 /** 94 /**
95 * Initialize a newly created annotated node. Either or both of the [comment] 95 * Initialize a newly created annotated node. Either or both of the [comment]
96 * and [metadata] can be `null` if the node does not have the corresponding 96 * and [metadata] can be `null` if the node does not have the corresponding
97 * attribute. 97 * attribute.
98 */ 98 */
99 AnnotatedNodeImpl(Comment comment, List<Annotation> metadata) { 99 AnnotatedNodeImpl(Comment comment, List<Annotation> metadata) {
100 _comment = _becomeParentOf(comment); 100 _comment = _becomeParentOf(comment);
101 _metadata = new NodeList<Annotation>(this, metadata); 101 _metadata = new NodeListImpl<Annotation>(this, metadata);
102 } 102 }
103 103
104 @override 104 @override
105 Token get beginToken { 105 Token get beginToken {
106 if (_comment == null) { 106 if (_comment == null) {
107 if (_metadata.isEmpty) { 107 if (_metadata.isEmpty) {
108 return firstTokenAfterCommentAndMetadata; 108 return firstTokenAfterCommentAndMetadata;
109 } 109 }
110 return _metadata.beginToken; 110 return _metadata.beginToken;
111 } else if (_metadata.isEmpty) { 111 } else if (_metadata.isEmpty) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 * does not correspond to a formal parameter. 365 * does not correspond to a formal parameter.
366 */ 366 */
367 List<ParameterElement> _correspondingPropagatedParameters; 367 List<ParameterElement> _correspondingPropagatedParameters;
368 368
369 /** 369 /**
370 * Initialize a newly created list of arguments. The list of [arguments] can 370 * Initialize a newly created list of arguments. The list of [arguments] can
371 * be `null` if there are no arguments. 371 * be `null` if there are no arguments.
372 */ 372 */
373 ArgumentListImpl( 373 ArgumentListImpl(
374 this.leftParenthesis, List<Expression> arguments, this.rightParenthesis) { 374 this.leftParenthesis, List<Expression> arguments, this.rightParenthesis) {
375 _arguments = new NodeList<Expression>(this, arguments); 375 _arguments = new NodeListImpl<Expression>(this, arguments);
376 } 376 }
377 377
378 @override 378 @override
379 NodeList<Expression> get arguments => _arguments; 379 NodeList<Expression> get arguments => _arguments;
380 380
381 @override 381 @override
382 Token get beginToken => leftParenthesis; 382 Token get beginToken => leftParenthesis;
383 383
384 @override 384 @override
385 // TODO(paulberry): Add commas. 385 // TODO(paulberry): Add commas.
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 /** 1238 /**
1239 * The right curly bracket. 1239 * The right curly bracket.
1240 */ 1240 */
1241 @override 1241 @override
1242 Token rightBracket; 1242 Token rightBracket;
1243 1243
1244 /** 1244 /**
1245 * Initialize a newly created block of code. 1245 * Initialize a newly created block of code.
1246 */ 1246 */
1247 BlockImpl(this.leftBracket, List<Statement> statements, this.rightBracket) { 1247 BlockImpl(this.leftBracket, List<Statement> statements, this.rightBracket) {
1248 _statements = new NodeList<Statement>(this, statements); 1248 _statements = new NodeListImpl<Statement>(this, statements);
1249 } 1249 }
1250 1250
1251 @override 1251 @override
1252 Token get beginToken => leftBracket; 1252 Token get beginToken => leftBracket;
1253 1253
1254 @override 1254 @override
1255 Iterable get childEntities => new ChildEntities() 1255 Iterable get childEntities => new ChildEntities()
1256 ..add(leftBracket) 1256 ..add(leftBracket)
1257 ..addAll(_statements) 1257 ..addAll(_statements)
1258 ..add(rightBracket); 1258 ..add(rightBracket);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 * The cascade sections sharing the common target. 1419 * The cascade sections sharing the common target.
1420 */ 1420 */
1421 NodeList<Expression> _cascadeSections; 1421 NodeList<Expression> _cascadeSections;
1422 1422
1423 /** 1423 /**
1424 * Initialize a newly created cascade expression. The list of 1424 * Initialize a newly created cascade expression. The list of
1425 * [cascadeSections] must contain at least one element. 1425 * [cascadeSections] must contain at least one element.
1426 */ 1426 */
1427 CascadeExpressionImpl(Expression target, List<Expression> cascadeSections) { 1427 CascadeExpressionImpl(Expression target, List<Expression> cascadeSections) {
1428 _target = _becomeParentOf(target); 1428 _target = _becomeParentOf(target);
1429 _cascadeSections = new NodeList<Expression>(this, cascadeSections); 1429 _cascadeSections = new NodeListImpl<Expression>(this, cascadeSections);
1430 } 1430 }
1431 1431
1432 @override 1432 @override
1433 Token get beginToken => _target.beginToken; 1433 Token get beginToken => _target.beginToken;
1434 1434
1435 @override 1435 @override
1436 NodeList<Expression> get cascadeSections => _cascadeSections; 1436 NodeList<Expression> get cascadeSections => _cascadeSections;
1437 1437
1438 @override 1438 @override
1439 Iterable get childEntities => new ChildEntities() 1439 Iterable get childEntities => new ChildEntities()
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 WithClause withClause, 1745 WithClause withClause,
1746 ImplementsClause implementsClause, 1746 ImplementsClause implementsClause,
1747 this.leftBracket, 1747 this.leftBracket,
1748 List<ClassMember> members, 1748 List<ClassMember> members,
1749 this.rightBracket) 1749 this.rightBracket)
1750 : super(comment, metadata, name) { 1750 : super(comment, metadata, name) {
1751 _typeParameters = _becomeParentOf(typeParameters); 1751 _typeParameters = _becomeParentOf(typeParameters);
1752 _extendsClause = _becomeParentOf(extendsClause); 1752 _extendsClause = _becomeParentOf(extendsClause);
1753 _withClause = _becomeParentOf(withClause); 1753 _withClause = _becomeParentOf(withClause);
1754 _implementsClause = _becomeParentOf(implementsClause); 1754 _implementsClause = _becomeParentOf(implementsClause);
1755 _members = new NodeList<ClassMember>(this, members); 1755 _members = new NodeListImpl<ClassMember>(this, members);
1756 } 1756 }
1757 1757
1758 @override 1758 @override
1759 Iterable get childEntities => super._childEntities 1759 Iterable get childEntities => super._childEntities
1760 ..add(abstractKeyword) 1760 ..add(abstractKeyword)
1761 ..add(classKeyword) 1761 ..add(classKeyword)
1762 ..add(_name) 1762 ..add(_name)
1763 ..add(_typeParameters) 1763 ..add(_typeParameters)
1764 ..add(_extendsClause) 1764 ..add(_extendsClause)
1765 ..add(_withClause) 1765 ..add(_withClause)
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 */ 2114 */
2115 NodeList<CommentReference> _references; 2115 NodeList<CommentReference> _references;
2116 2116
2117 /** 2117 /**
2118 * Initialize a newly created comment. The list of [tokens] must contain at 2118 * Initialize a newly created comment. The list of [tokens] must contain at
2119 * least one token. The [type] is the type of the comment. The list of 2119 * least one token. The [type] is the type of the comment. The list of
2120 * [references] can be empty if the comment does not contain any embedded 2120 * [references] can be empty if the comment does not contain any embedded
2121 * references. 2121 * references.
2122 */ 2122 */
2123 CommentImpl(this.tokens, this._type, List<CommentReference> references) { 2123 CommentImpl(this.tokens, this._type, List<CommentReference> references) {
2124 _references = new NodeList<CommentReference>(this, references); 2124 _references = new NodeListImpl<CommentReference>(this, references);
2125 } 2125 }
2126 2126
2127 @override 2127 @override
2128 Token get beginToken => tokens[0]; 2128 Token get beginToken => tokens[0];
2129 2129
2130 @override 2130 @override
2131 Iterable get childEntities => new ChildEntities()..addAll(tokens); 2131 Iterable get childEntities => new ChildEntities()..addAll(tokens);
2132 2132
2133 @override 2133 @override
2134 Token get endToken => tokens[tokens.length - 1]; 2134 Token get endToken => tokens[tokens.length - 1];
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 * are no directives in the compilation unit. The list of [declarations] can 2344 * are no directives in the compilation unit. The list of [declarations] can
2345 * be `null` if there are no declarations in the compilation unit. 2345 * be `null` if there are no declarations in the compilation unit.
2346 */ 2346 */
2347 CompilationUnitImpl( 2347 CompilationUnitImpl(
2348 this.beginToken, 2348 this.beginToken,
2349 ScriptTag scriptTag, 2349 ScriptTag scriptTag,
2350 List<Directive> directives, 2350 List<Directive> directives,
2351 List<CompilationUnitMember> declarations, 2351 List<CompilationUnitMember> declarations,
2352 this.endToken) { 2352 this.endToken) {
2353 _scriptTag = _becomeParentOf(scriptTag); 2353 _scriptTag = _becomeParentOf(scriptTag);
2354 _directives = new NodeList<Directive>(this, directives); 2354 _directives = new NodeListImpl<Directive>(this, directives);
2355 _declarations = new NodeList<CompilationUnitMember>(this, declarations); 2355 _declarations = new NodeListImpl<CompilationUnitMember>(this, declarations);
2356 } 2356 }
2357 2357
2358 @override 2358 @override
2359 Iterable get childEntities { 2359 Iterable get childEntities {
2360 ChildEntities result = new ChildEntities()..add(_scriptTag); 2360 ChildEntities result = new ChildEntities()..add(_scriptTag);
2361 if (_directivesAreBeforeDeclarations) { 2361 if (_directivesAreBeforeDeclarations) {
2362 result..addAll(_directives)..addAll(_declarations); 2362 result..addAll(_directives)..addAll(_declarations);
2363 } else { 2363 } else {
2364 result.addAll(sortedDirectivesAndDeclarations); 2364 result.addAll(sortedDirectivesAndDeclarations);
2365 } 2365 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 SimpleIdentifier name, 2769 SimpleIdentifier name,
2770 FormalParameterList parameters, 2770 FormalParameterList parameters,
2771 this.separator, 2771 this.separator,
2772 List<ConstructorInitializer> initializers, 2772 List<ConstructorInitializer> initializers,
2773 ConstructorName redirectedConstructor, 2773 ConstructorName redirectedConstructor,
2774 FunctionBody body) 2774 FunctionBody body)
2775 : super(comment, metadata) { 2775 : super(comment, metadata) {
2776 _returnType = _becomeParentOf(returnType); 2776 _returnType = _becomeParentOf(returnType);
2777 _name = _becomeParentOf(name); 2777 _name = _becomeParentOf(name);
2778 _parameters = _becomeParentOf(parameters); 2778 _parameters = _becomeParentOf(parameters);
2779 _initializers = new NodeList<ConstructorInitializer>(this, initializers); 2779 _initializers =
2780 new NodeListImpl<ConstructorInitializer>(this, initializers);
2780 _redirectedConstructor = _becomeParentOf(redirectedConstructor); 2781 _redirectedConstructor = _becomeParentOf(redirectedConstructor);
2781 _body = _becomeParentOf(body); 2782 _body = _becomeParentOf(body);
2782 } 2783 }
2783 2784
2784 @override 2785 @override
2785 FunctionBody get body => _body; 2786 FunctionBody get body => _body;
2786 2787
2787 @override 2788 @override
2788 void set body(FunctionBody functionBody) { 2789 void set body(FunctionBody functionBody) {
2789 _body = _becomeParentOf(functionBody); 2790 _body = _becomeParentOf(functionBody);
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 class DottedNameImpl extends AstNodeImpl implements DottedName { 3516 class DottedNameImpl extends AstNodeImpl implements DottedName {
3516 /** 3517 /**
3517 * The components of the identifier. 3518 * The components of the identifier.
3518 */ 3519 */
3519 NodeList<SimpleIdentifier> _components; 3520 NodeList<SimpleIdentifier> _components;
3520 3521
3521 /** 3522 /**
3522 * Initialize a newly created dotted name. 3523 * Initialize a newly created dotted name.
3523 */ 3524 */
3524 DottedNameImpl(List<SimpleIdentifier> components) { 3525 DottedNameImpl(List<SimpleIdentifier> components) {
3525 _components = new NodeList<SimpleIdentifier>(this, components); 3526 _components = new NodeListImpl<SimpleIdentifier>(this, components);
3526 } 3527 }
3527 3528
3528 @override 3529 @override
3529 Token get beginToken => _components.beginToken; 3530 Token get beginToken => _components.beginToken;
3530 3531
3531 @override 3532 @override
3532 // TODO(paulberry): add "." tokens. 3533 // TODO(paulberry): add "." tokens.
3533 Iterable get childEntities => new ChildEntities()..addAll(_components); 3534 Iterable get childEntities => new ChildEntities()..addAll(_components);
3534 3535
3535 @override 3536 @override
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 */ 3764 */
3764 EnumDeclarationImpl( 3765 EnumDeclarationImpl(
3765 Comment comment, 3766 Comment comment,
3766 List<Annotation> metadata, 3767 List<Annotation> metadata,
3767 this.enumKeyword, 3768 this.enumKeyword,
3768 SimpleIdentifier name, 3769 SimpleIdentifier name,
3769 this.leftBracket, 3770 this.leftBracket,
3770 List<EnumConstantDeclaration> constants, 3771 List<EnumConstantDeclaration> constants,
3771 this.rightBracket) 3772 this.rightBracket)
3772 : super(comment, metadata, name) { 3773 : super(comment, metadata, name) {
3773 _constants = new NodeList<EnumConstantDeclaration>(this, constants); 3774 _constants = new NodeListImpl<EnumConstantDeclaration>(this, constants);
3774 } 3775 }
3775 3776
3776 @override 3777 @override
3777 // TODO(brianwilkerson) Add commas? 3778 // TODO(brianwilkerson) Add commas?
3778 Iterable get childEntities => super._childEntities 3779 Iterable get childEntities => super._childEntities
3779 ..add(enumKeyword) 3780 ..add(enumKeyword)
3780 ..add(_name) 3781 ..add(_name)
3781 ..add(leftBracket) 3782 ..add(leftBracket)
3782 ..addAll(_constants) 3783 ..addAll(_constants)
3783 ..add(rightBracket); 3784 ..add(rightBracket);
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 * Initialize a newly created parameter list. The list of [parameters] can be 4645 * Initialize a newly created parameter list. The list of [parameters] can be
4645 * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter] 4646 * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter]
4646 * can be `null` if there are no optional parameters. 4647 * can be `null` if there are no optional parameters.
4647 */ 4648 */
4648 FormalParameterListImpl( 4649 FormalParameterListImpl(
4649 this.leftParenthesis, 4650 this.leftParenthesis,
4650 List<FormalParameter> parameters, 4651 List<FormalParameter> parameters,
4651 this.leftDelimiter, 4652 this.leftDelimiter,
4652 this.rightDelimiter, 4653 this.rightDelimiter,
4653 this.rightParenthesis) { 4654 this.rightParenthesis) {
4654 _parameters = new NodeList<FormalParameter>(this, parameters); 4655 _parameters = new NodeListImpl<FormalParameter>(this, parameters);
4655 } 4656 }
4656 4657
4657 @override 4658 @override
4658 Token get beginToken => leftParenthesis; 4659 Token get beginToken => leftParenthesis;
4659 4660
4660 @override 4661 @override
4661 Iterable get childEntities { 4662 Iterable get childEntities {
4662 // TODO(paulberry): include commas. 4663 // TODO(paulberry): include commas.
4663 ChildEntities result = new ChildEntities()..add(leftParenthesis); 4664 ChildEntities result = new ChildEntities()..add(leftParenthesis);
4664 bool leftDelimiterNeeded = leftDelimiter != null; 4665 bool leftDelimiterNeeded = leftDelimiter != null;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4785 Expression initialization, 4786 Expression initialization,
4786 this.leftSeparator, 4787 this.leftSeparator,
4787 Expression condition, 4788 Expression condition,
4788 this.rightSeparator, 4789 this.rightSeparator,
4789 List<Expression> updaters, 4790 List<Expression> updaters,
4790 this.rightParenthesis, 4791 this.rightParenthesis,
4791 Statement body) { 4792 Statement body) {
4792 _variableList = _becomeParentOf(variableList); 4793 _variableList = _becomeParentOf(variableList);
4793 _initialization = _becomeParentOf(initialization); 4794 _initialization = _becomeParentOf(initialization);
4794 _condition = _becomeParentOf(condition); 4795 _condition = _becomeParentOf(condition);
4795 _updaters = new NodeList<Expression>(this, updaters); 4796 _updaters = new NodeListImpl<Expression>(this, updaters);
4796 _body = _becomeParentOf(body); 4797 _body = _becomeParentOf(body);
4797 } 4798 }
4798 4799
4799 @override 4800 @override
4800 Token get beginToken => forKeyword; 4801 Token get beginToken => forKeyword;
4801 4802
4802 @override 4803 @override
4803 Statement get body => _body; 4804 Statement get body => _body;
4804 4805
4805 @override 4806 @override
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 /** 5501 /**
5501 * The list of names from the library that are hidden by this combinator. 5502 * The list of names from the library that are hidden by this combinator.
5502 */ 5503 */
5503 NodeList<SimpleIdentifier> _hiddenNames; 5504 NodeList<SimpleIdentifier> _hiddenNames;
5504 5505
5505 /** 5506 /**
5506 * Initialize a newly created import show combinator. 5507 * Initialize a newly created import show combinator.
5507 */ 5508 */
5508 HideCombinatorImpl(Token keyword, List<SimpleIdentifier> hiddenNames) 5509 HideCombinatorImpl(Token keyword, List<SimpleIdentifier> hiddenNames)
5509 : super(keyword) { 5510 : super(keyword) {
5510 _hiddenNames = new NodeList<SimpleIdentifier>(this, hiddenNames); 5511 _hiddenNames = new NodeListImpl<SimpleIdentifier>(this, hiddenNames);
5511 } 5512 }
5512 5513
5513 @override 5514 @override
5514 Iterable get childEntities => new ChildEntities() 5515 Iterable get childEntities => new ChildEntities()
5515 ..add(keyword) 5516 ..add(keyword)
5516 ..addAll(_hiddenNames); 5517 ..addAll(_hiddenNames);
5517 5518
5518 @override 5519 @override
5519 Token get endToken => _hiddenNames.endToken; 5520 Token get endToken => _hiddenNames.endToken;
5520 5521
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
5689 5690
5690 /** 5691 /**
5691 * The interfaces that are being implemented. 5692 * The interfaces that are being implemented.
5692 */ 5693 */
5693 NodeList<TypeName> _interfaces; 5694 NodeList<TypeName> _interfaces;
5694 5695
5695 /** 5696 /**
5696 * Initialize a newly created implements clause. 5697 * Initialize a newly created implements clause.
5697 */ 5698 */
5698 ImplementsClauseImpl(this.implementsKeyword, List<TypeName> interfaces) { 5699 ImplementsClauseImpl(this.implementsKeyword, List<TypeName> interfaces) {
5699 _interfaces = new NodeList<TypeName>(this, interfaces); 5700 _interfaces = new NodeListImpl<TypeName>(this, interfaces);
5700 } 5701 }
5701 5702
5702 @override 5703 @override
5703 Token get beginToken => implementsKeyword; 5704 Token get beginToken => implementsKeyword;
5704 5705
5705 @override 5706 @override
5706 // TODO(paulberry): add commas. 5707 // TODO(paulberry): add commas.
5707 Iterable get childEntities => new ChildEntities() 5708 Iterable get childEntities => new ChildEntities()
5708 ..add(implementsKeyword) 5709 ..add(implementsKeyword)
5709 ..addAll(interfaces); 5710 ..addAll(interfaces);
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 6457
6457 /** 6458 /**
6458 * The statement with which the labels are being associated. 6459 * The statement with which the labels are being associated.
6459 */ 6460 */
6460 Statement _statement; 6461 Statement _statement;
6461 6462
6462 /** 6463 /**
6463 * Initialize a newly created labeled statement. 6464 * Initialize a newly created labeled statement.
6464 */ 6465 */
6465 LabeledStatementImpl(List<Label> labels, Statement statement) { 6466 LabeledStatementImpl(List<Label> labels, Statement statement) {
6466 _labels = new NodeList<Label>(this, labels); 6467 _labels = new NodeListImpl<Label>(this, labels);
6467 _statement = _becomeParentOf(statement); 6468 _statement = _becomeParentOf(statement);
6468 } 6469 }
6469 6470
6470 @override 6471 @override
6471 Token get beginToken { 6472 Token get beginToken {
6472 if (!_labels.isEmpty) { 6473 if (!_labels.isEmpty) {
6473 return _labels.beginToken; 6474 return _labels.beginToken;
6474 } 6475 }
6475 return _statement.beginToken; 6476 return _statement.beginToken;
6476 } 6477 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
6637 implements LibraryIdentifier { 6638 implements LibraryIdentifier {
6638 /** 6639 /**
6639 * The components of the identifier. 6640 * The components of the identifier.
6640 */ 6641 */
6641 NodeList<SimpleIdentifier> _components; 6642 NodeList<SimpleIdentifier> _components;
6642 6643
6643 /** 6644 /**
6644 * Initialize a newly created prefixed identifier. 6645 * Initialize a newly created prefixed identifier.
6645 */ 6646 */
6646 LibraryIdentifierImpl(List<SimpleIdentifier> components) { 6647 LibraryIdentifierImpl(List<SimpleIdentifier> components) {
6647 _components = new NodeList<SimpleIdentifier>(this, components); 6648 _components = new NodeListImpl<SimpleIdentifier>(this, components);
6648 } 6649 }
6649 6650
6650 @override 6651 @override
6651 Token get beginToken => _components.beginToken; 6652 Token get beginToken => _components.beginToken;
6652 6653
6653 @override 6654 @override
6654 Element get bestElement => staticElement; 6655 Element get bestElement => staticElement;
6655 6656
6656 @override 6657 @override
6657 // TODO(paulberry): add "." tokens. 6658 // TODO(paulberry): add "." tokens.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
6723 6724
6724 /** 6725 /**
6725 * Initialize a newly created list literal. The [constKeyword] can be `null` 6726 * Initialize a newly created list literal. The [constKeyword] can be `null`
6726 * if the literal is not a constant. The [typeArguments] can be `null` if no 6727 * if the literal is not a constant. The [typeArguments] can be `null` if no
6727 * type arguments were declared. The list of [elements] can be `null` if the 6728 * type arguments were declared. The list of [elements] can be `null` if the
6728 * list is empty. 6729 * list is empty.
6729 */ 6730 */
6730 ListLiteralImpl(Token constKeyword, TypeArgumentList typeArguments, 6731 ListLiteralImpl(Token constKeyword, TypeArgumentList typeArguments,
6731 this.leftBracket, List<Expression> elements, this.rightBracket) 6732 this.leftBracket, List<Expression> elements, this.rightBracket)
6732 : super(constKeyword, typeArguments) { 6733 : super(constKeyword, typeArguments) {
6733 _elements = new NodeList<Expression>(this, elements); 6734 _elements = new NodeListImpl<Expression>(this, elements);
6734 } 6735 }
6735 6736
6736 @override 6737 @override
6737 Token get beginToken { 6738 Token get beginToken {
6738 if (constKeyword != null) { 6739 if (constKeyword != null) {
6739 return constKeyword; 6740 return constKeyword;
6740 } 6741 }
6741 TypeArgumentList typeArguments = this.typeArguments; 6742 TypeArgumentList typeArguments = this.typeArguments;
6742 if (typeArguments != null) { 6743 if (typeArguments != null) {
6743 return typeArguments.beginToken; 6744 return typeArguments.beginToken;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
6900 Token rightBracket; 6901 Token rightBracket;
6901 6902
6902 /** 6903 /**
6903 * Initialize a newly created map literal. The [constKeyword] can be `null` if 6904 * Initialize a newly created map literal. The [constKeyword] can be `null` if
6904 * the literal is not a constant. The [typeArguments] can be `null` if no type 6905 * the literal is not a constant. The [typeArguments] can be `null` if no type
6905 * arguments were declared. The [entries] can be `null` if the map is empty. 6906 * arguments were declared. The [entries] can be `null` if the map is empty.
6906 */ 6907 */
6907 MapLiteralImpl(Token constKeyword, TypeArgumentList typeArguments, 6908 MapLiteralImpl(Token constKeyword, TypeArgumentList typeArguments,
6908 this.leftBracket, List<MapLiteralEntry> entries, this.rightBracket) 6909 this.leftBracket, List<MapLiteralEntry> entries, this.rightBracket)
6909 : super(constKeyword, typeArguments) { 6910 : super(constKeyword, typeArguments) {
6910 _entries = new NodeList<MapLiteralEntry>(this, entries); 6911 _entries = new NodeListImpl<MapLiteralEntry>(this, entries);
6911 } 6912 }
6912 6913
6913 @override 6914 @override
6914 Token get beginToken { 6915 Token get beginToken {
6915 if (constKeyword != null) { 6916 if (constKeyword != null) {
6916 return constKeyword; 6917 return constKeyword;
6917 } 6918 }
6918 TypeArgumentList typeArguments = this.typeArguments; 6919 TypeArgumentList typeArguments = this.typeArguments;
6919 if (typeArguments != null) { 6920 if (typeArguments != null) {
6920 return typeArguments.beginToken; 6921 return typeArguments.beginToken;
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
7427 */ 7428 */
7428 NamespaceDirectiveImpl( 7429 NamespaceDirectiveImpl(
7429 Comment comment, 7430 Comment comment,
7430 List<Annotation> metadata, 7431 List<Annotation> metadata,
7431 this.keyword, 7432 this.keyword,
7432 StringLiteral libraryUri, 7433 StringLiteral libraryUri,
7433 List<Configuration> configurations, 7434 List<Configuration> configurations,
7434 List<Combinator> combinators, 7435 List<Combinator> combinators,
7435 this.semicolon) 7436 this.semicolon)
7436 : super(comment, metadata, libraryUri) { 7437 : super(comment, metadata, libraryUri) {
7437 _configurations = new NodeList<Configuration>(this, configurations); 7438 _configurations = new NodeListImpl<Configuration>(this, configurations);
7438 _combinators = new NodeList<Combinator>(this, combinators); 7439 _combinators = new NodeListImpl<Combinator>(this, combinators);
7439 } 7440 }
7440 7441
7441 @override 7442 @override
7442 NodeList<Combinator> get combinators => _combinators; 7443 NodeList<Combinator> get combinators => _combinators;
7443 7444
7444 @override 7445 @override
7445 NodeList<Configuration> get configurations => _configurations; 7446 NodeList<Configuration> get configurations => _configurations;
7446 7447
7447 @override 7448 @override
7448 Token get endToken => semicolon; 7449 Token get endToken => semicolon;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
7728 SimpleIdentifier _identifier; 7729 SimpleIdentifier _identifier;
7729 7730
7730 /** 7731 /**
7731 * Initialize a newly created formal parameter. Either or both of the 7732 * Initialize a newly created formal parameter. Either or both of the
7732 * [comment] and [metadata] can be `null` if the parameter does not have the 7733 * [comment] and [metadata] can be `null` if the parameter does not have the
7733 * corresponding attribute. 7734 * corresponding attribute.
7734 */ 7735 */
7735 NormalFormalParameterImpl( 7736 NormalFormalParameterImpl(
7736 Comment comment, List<Annotation> metadata, SimpleIdentifier identifier) { 7737 Comment comment, List<Annotation> metadata, SimpleIdentifier identifier) {
7737 _comment = _becomeParentOf(comment); 7738 _comment = _becomeParentOf(comment);
7738 _metadata = new NodeList<Annotation>(this, metadata); 7739 _metadata = new NodeListImpl<Annotation>(this, metadata);
7739 _identifier = _becomeParentOf(identifier); 7740 _identifier = _becomeParentOf(identifier);
7740 } 7741 }
7741 7742
7742 @override 7743 @override
7743 Comment get documentationComment => _comment; 7744 Comment get documentationComment => _comment;
7744 7745
7745 @override 7746 @override
7746 void set documentationComment(Comment comment) { 7747 void set documentationComment(Comment comment) {
7747 _comment = _becomeParentOf(comment); 7748 _comment = _becomeParentOf(comment);
7748 } 7749 }
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
8749 /** 8750 /**
8750 * The list of names from the library that are made visible by this combinator . 8751 * The list of names from the library that are made visible by this combinator .
8751 */ 8752 */
8752 NodeList<SimpleIdentifier> _shownNames; 8753 NodeList<SimpleIdentifier> _shownNames;
8753 8754
8754 /** 8755 /**
8755 * Initialize a newly created import show combinator. 8756 * Initialize a newly created import show combinator.
8756 */ 8757 */
8757 ShowCombinatorImpl(Token keyword, List<SimpleIdentifier> shownNames) 8758 ShowCombinatorImpl(Token keyword, List<SimpleIdentifier> shownNames)
8758 : super(keyword) { 8759 : super(keyword) {
8759 _shownNames = new NodeList<SimpleIdentifier>(this, shownNames); 8760 _shownNames = new NodeListImpl<SimpleIdentifier>(this, shownNames);
8760 } 8761 }
8761 8762
8762 @override 8763 @override
8763 // TODO(paulberry): add commas. 8764 // TODO(paulberry): add commas.
8764 Iterable get childEntities => new ChildEntities() 8765 Iterable get childEntities => new ChildEntities()
8765 ..add(keyword) 8766 ..add(keyword)
8766 ..addAll(_shownNames); 8767 ..addAll(_shownNames);
8767 8768
8768 @override 8769 @override
8769 Token get endToken => _shownNames.endToken; 8770 Token get endToken => _shownNames.endToken;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
9185 implements StringInterpolation { 9186 implements StringInterpolation {
9186 /** 9187 /**
9187 * The elements that will be composed to produce the resulting string. 9188 * The elements that will be composed to produce the resulting string.
9188 */ 9189 */
9189 NodeList<InterpolationElement> _elements; 9190 NodeList<InterpolationElement> _elements;
9190 9191
9191 /** 9192 /**
9192 * Initialize a newly created string interpolation expression. 9193 * Initialize a newly created string interpolation expression.
9193 */ 9194 */
9194 StringInterpolationImpl(List<InterpolationElement> elements) { 9195 StringInterpolationImpl(List<InterpolationElement> elements) {
9195 _elements = new NodeList<InterpolationElement>(this, elements); 9196 _elements = new NodeListImpl<InterpolationElement>(this, elements);
9196 } 9197 }
9197 9198
9198 @override 9199 @override
9199 Token get beginToken => _elements.beginToken; 9200 Token get beginToken => _elements.beginToken;
9200 9201
9201 @override 9202 @override
9202 Iterable get childEntities => new ChildEntities()..addAll(_elements); 9203 Iterable get childEntities => new ChildEntities()..addAll(_elements);
9203 9204
9204 @override 9205 @override
9205 int get contentsEnd { 9206 int get contentsEnd {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
9613 * The statements that will be executed if this switch member is selected. 9614 * The statements that will be executed if this switch member is selected.
9614 */ 9615 */
9615 NodeList<Statement> _statements; 9616 NodeList<Statement> _statements;
9616 9617
9617 /** 9618 /**
9618 * Initialize a newly created switch member. The list of [labels] can be 9619 * Initialize a newly created switch member. The list of [labels] can be
9619 * `null` if there are no labels. 9620 * `null` if there are no labels.
9620 */ 9621 */
9621 SwitchMemberImpl(List<Label> labels, this.keyword, this.colon, 9622 SwitchMemberImpl(List<Label> labels, this.keyword, this.colon,
9622 List<Statement> statements) { 9623 List<Statement> statements) {
9623 _labels = new NodeList<Label>(this, labels); 9624 _labels = new NodeListImpl<Label>(this, labels);
9624 _statements = new NodeList<Statement>(this, statements); 9625 _statements = new NodeListImpl<Statement>(this, statements);
9625 } 9626 }
9626 9627
9627 @override 9628 @override
9628 Token get beginToken { 9629 Token get beginToken {
9629 if (!_labels.isEmpty) { 9630 if (!_labels.isEmpty) {
9630 return _labels.beginToken; 9631 return _labels.beginToken;
9631 } 9632 }
9632 return keyword; 9633 return keyword;
9633 } 9634 }
9634 9635
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
9696 */ 9697 */
9697 SwitchStatementImpl( 9698 SwitchStatementImpl(
9698 this.switchKeyword, 9699 this.switchKeyword,
9699 this.leftParenthesis, 9700 this.leftParenthesis,
9700 Expression expression, 9701 Expression expression,
9701 this.rightParenthesis, 9702 this.rightParenthesis,
9702 this.leftBracket, 9703 this.leftBracket,
9703 List<SwitchMember> members, 9704 List<SwitchMember> members,
9704 this.rightBracket) { 9705 this.rightBracket) {
9705 _expression = _becomeParentOf(expression); 9706 _expression = _becomeParentOf(expression);
9706 _members = new NodeList<SwitchMember>(this, members); 9707 _members = new NodeListImpl<SwitchMember>(this, members);
9707 } 9708 }
9708 9709
9709 @override 9710 @override
9710 Token get beginToken => switchKeyword; 9711 Token get beginToken => switchKeyword;
9711 9712
9712 @override 9713 @override
9713 Iterable get childEntities => new ChildEntities() 9714 Iterable get childEntities => new ChildEntities()
9714 ..add(switchKeyword) 9715 ..add(switchKeyword)
9715 ..add(leftParenthesis) 9716 ..add(leftParenthesis)
9716 ..add(_expression) 9717 ..add(_expression)
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
9987 Block _finallyBlock; 9988 Block _finallyBlock;
9988 9989
9989 /** 9990 /**
9990 * Initialize a newly created try statement. The list of [catchClauses] can be 9991 * Initialize a newly created try statement. The list of [catchClauses] can be
9991 * `null` if there are no catch clauses. The [finallyKeyword] and 9992 * `null` if there are no catch clauses. The [finallyKeyword] and
9992 * [finallyBlock] can be `null` if there is no finally clause. 9993 * [finallyBlock] can be `null` if there is no finally clause.
9993 */ 9994 */
9994 TryStatementImpl(this.tryKeyword, Block body, List<CatchClause> catchClauses, 9995 TryStatementImpl(this.tryKeyword, Block body, List<CatchClause> catchClauses,
9995 this.finallyKeyword, Block finallyBlock) { 9996 this.finallyKeyword, Block finallyBlock) {
9996 _body = _becomeParentOf(body); 9997 _body = _becomeParentOf(body);
9997 _catchClauses = new NodeList<CatchClause>(this, catchClauses); 9998 _catchClauses = new NodeListImpl<CatchClause>(this, catchClauses);
9998 _finallyBlock = _becomeParentOf(finallyBlock); 9999 _finallyBlock = _becomeParentOf(finallyBlock);
9999 } 10000 }
10000 10001
10001 @override 10002 @override
10002 Token get beginToken => tryKeyword; 10003 Token get beginToken => tryKeyword;
10003 10004
10004 @override 10005 @override
10005 Block get body => _body; 10006 Block get body => _body;
10006 10007
10007 @override 10008 @override
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
10110 /** 10111 /**
10111 * The right bracket. 10112 * The right bracket.
10112 */ 10113 */
10113 Token rightBracket; 10114 Token rightBracket;
10114 10115
10115 /** 10116 /**
10116 * Initialize a newly created list of type arguments. 10117 * Initialize a newly created list of type arguments.
10117 */ 10118 */
10118 TypeArgumentListImpl( 10119 TypeArgumentListImpl(
10119 this.leftBracket, List<TypeName> arguments, this.rightBracket) { 10120 this.leftBracket, List<TypeName> arguments, this.rightBracket) {
10120 _arguments = new NodeList<TypeName>(this, arguments); 10121 _arguments = new NodeListImpl<TypeName>(this, arguments);
10121 } 10122 }
10122 10123
10123 @override 10124 @override
10124 NodeList<TypeName> get arguments => _arguments; 10125 NodeList<TypeName> get arguments => _arguments;
10125 10126
10126 @override 10127 @override
10127 Token get beginToken => leftBracket; 10128 Token get beginToken => leftBracket;
10128 10129
10129 @override 10130 @override
10130 // TODO(paulberry): Add commas. 10131 // TODO(paulberry): Add commas.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
10382 /** 10383 /**
10383 * The right angle bracket. 10384 * The right angle bracket.
10384 */ 10385 */
10385 final Token rightBracket; 10386 final Token rightBracket;
10386 10387
10387 /** 10388 /**
10388 * Initialize a newly created list of type parameters. 10389 * Initialize a newly created list of type parameters.
10389 */ 10390 */
10390 TypeParameterListImpl( 10391 TypeParameterListImpl(
10391 this.leftBracket, List<TypeParameter> typeParameters, this.rightBracket) { 10392 this.leftBracket, List<TypeParameter> typeParameters, this.rightBracket) {
10392 _typeParameters = new NodeList<TypeParameter>(this, typeParameters); 10393 _typeParameters = new NodeListImpl<TypeParameter>(this, typeParameters);
10393 } 10394 }
10394 10395
10395 @override 10396 @override
10396 Token get beginToken => leftBracket; 10397 Token get beginToken => leftBracket;
10397 10398
10398 @override 10399 @override
10399 Iterable get childEntities => new ChildEntities() 10400 Iterable get childEntities => new ChildEntities()
10400 ..add(leftBracket) 10401 ..add(leftBracket)
10401 ..addAll(_typeParameters) 10402 ..addAll(_typeParameters)
10402 ..add(rightBracket); 10403 ..add(rightBracket);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
10672 /** 10673 /**
10673 * Initialize a newly created variable declaration list. Either or both of the 10674 * Initialize a newly created variable declaration list. Either or both of the
10674 * [comment] and [metadata] can be `null` if the variable list does not have 10675 * [comment] and [metadata] can be `null` if the variable list does not have
10675 * the corresponding attribute. The [keyword] can be `null` if a type was 10676 * the corresponding attribute. The [keyword] can be `null` if a type was
10676 * specified. The [type] must be `null` if the keyword is 'var'. 10677 * specified. The [type] must be `null` if the keyword is 'var'.
10677 */ 10678 */
10678 VariableDeclarationListImpl(Comment comment, List<Annotation> metadata, 10679 VariableDeclarationListImpl(Comment comment, List<Annotation> metadata,
10679 this.keyword, TypeName type, List<VariableDeclaration> variables) 10680 this.keyword, TypeName type, List<VariableDeclaration> variables)
10680 : super(comment, metadata) { 10681 : super(comment, metadata) {
10681 _type = _becomeParentOf(type); 10682 _type = _becomeParentOf(type);
10682 _variables = new NodeList<VariableDeclaration>(this, variables); 10683 _variables = new NodeListImpl<VariableDeclaration>(this, variables);
10683 } 10684 }
10684 10685
10685 @override 10686 @override
10686 // TODO(paulberry): include commas. 10687 // TODO(paulberry): include commas.
10687 Iterable get childEntities => super._childEntities 10688 Iterable get childEntities => super._childEntities
10688 ..add(keyword) 10689 ..add(keyword)
10689 ..add(_type) 10690 ..add(_type)
10690 ..addAll(_variables); 10691 ..addAll(_variables);
10691 10692
10692 @override 10693 @override
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
10882 10883
10883 /** 10884 /**
10884 * The names of the mixins that were specified. 10885 * The names of the mixins that were specified.
10885 */ 10886 */
10886 NodeList<TypeName> _mixinTypes; 10887 NodeList<TypeName> _mixinTypes;
10887 10888
10888 /** 10889 /**
10889 * Initialize a newly created with clause. 10890 * Initialize a newly created with clause.
10890 */ 10891 */
10891 WithClauseImpl(this.withKeyword, List<TypeName> mixinTypes) { 10892 WithClauseImpl(this.withKeyword, List<TypeName> mixinTypes) {
10892 _mixinTypes = new NodeList<TypeName>(this, mixinTypes); 10893 _mixinTypes = new NodeListImpl<TypeName>(this, mixinTypes);
10893 } 10894 }
10894 10895
10895 @override 10896 @override
10896 Token get beginToken => withKeyword; 10897 Token get beginToken => withKeyword;
10897 10898
10898 @override 10899 @override
10899 // TODO(paulberry): add commas. 10900 // TODO(paulberry): add commas.
10900 Iterable get childEntities => new ChildEntities() 10901 Iterable get childEntities => new ChildEntities()
10901 ..add(withKeyword) 10902 ..add(withKeyword)
10902 ..addAll(_mixinTypes); 10903 ..addAll(_mixinTypes);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
10986 10987
10987 @override 10988 @override
10988 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 10989 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
10989 visitor.visitYieldStatement(this); 10990 visitor.visitYieldStatement(this);
10990 10991
10991 @override 10992 @override
10992 void visitChildren(AstVisitor visitor) { 10993 void visitChildren(AstVisitor visitor) {
10993 _expression?.accept(visitor); 10994 _expression?.accept(visitor);
10994 } 10995 }
10995 } 10996 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698