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

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

Issue 2637753003: Ast changes to support the covariant keyword (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/ast.dart ('k') | 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/syntactic_entity.dart'; 10 import 'package:analyzer/dart/ast/syntactic_entity.dart';
(...skipping 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 } 3439 }
3440 3440
3441 @override 3441 @override
3442 Token get beginToken => _parameter.beginToken; 3442 Token get beginToken => _parameter.beginToken;
3443 3443
3444 @override 3444 @override
3445 Iterable<SyntacticEntity> get childEntities => 3445 Iterable<SyntacticEntity> get childEntities =>
3446 new ChildEntities()..add(_parameter)..add(separator)..add(_defaultValue); 3446 new ChildEntities()..add(_parameter)..add(separator)..add(_defaultValue);
3447 3447
3448 @override 3448 @override
3449 Token get covariantKeyword => null;
3450
3451 @override
3449 Expression get defaultValue => _defaultValue; 3452 Expression get defaultValue => _defaultValue;
3450 3453
3451 @override 3454 @override
3452 void set defaultValue(Expression expression) { 3455 void set defaultValue(Expression expression) {
3453 _defaultValue = _becomeParentOf(expression as AstNodeImpl); 3456 _defaultValue = _becomeParentOf(expression as AstNodeImpl);
3454 } 3457 }
3455 3458
3456 @override 3459 @override
3457 Token get endToken { 3460 Token get endToken {
3458 if (_defaultValue != null) { 3461 if (_defaultValue != null) {
(...skipping 4636 matching lines...) Expand 10 before | Expand all | Expand 10 after
8095 * parameter does not have a documentation comment associated with it. 8098 * parameter does not have a documentation comment associated with it.
8096 */ 8099 */
8097 Comment _comment; 8100 Comment _comment;
8098 8101
8099 /** 8102 /**
8100 * The annotations associated with this parameter. 8103 * The annotations associated with this parameter.
8101 */ 8104 */
8102 NodeList<Annotation> _metadata; 8105 NodeList<Annotation> _metadata;
8103 8106
8104 /** 8107 /**
8108 * The 'covariant' keyword, or `null` if the keyword was not used.
8109 */
8110 Token covariantKeyword;
8111
8112 /**
8105 * The name of the parameter being declared. 8113 * The name of the parameter being declared.
8106 */ 8114 */
8107 SimpleIdentifier _identifier; 8115 SimpleIdentifier _identifier;
8108 8116
8109 /** 8117 /**
8110 * Initialize a newly created formal parameter. Either or both of the 8118 * Initialize a newly created formal parameter. Either or both of the
8111 * [comment] and [metadata] can be `null` if the parameter does not have the 8119 * [comment] and [metadata] can be `null` if the parameter does not have the
8112 * corresponding attribute. 8120 * corresponding attribute.
8113 */ 8121 */
8114 NormalFormalParameterImpl(CommentImpl comment, List<Annotation> metadata, 8122 NormalFormalParameterImpl(CommentImpl comment, List<Annotation> metadata,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
8162 8170
8163 ChildEntities get _childEntities { 8171 ChildEntities get _childEntities {
8164 ChildEntities result = new ChildEntities(); 8172 ChildEntities result = new ChildEntities();
8165 if (_commentIsBeforeAnnotations()) { 8173 if (_commentIsBeforeAnnotations()) {
8166 result 8174 result
8167 ..add(_comment) 8175 ..add(_comment)
8168 ..addAll(_metadata); 8176 ..addAll(_metadata);
8169 } else { 8177 } else {
8170 result.addAll(sortedCommentAndAnnotations); 8178 result.addAll(sortedCommentAndAnnotations);
8171 } 8179 }
8180 if (covariantKeyword != null) {
8181 result.add(covariantKeyword);
scheglov 2017/01/18 04:29:59 Do we need to update beginToken?
Brian Wilkerson 2017/01/18 17:19:29 Yes. Good catch. I'll have an update out shortly.
8182 }
8172 return result; 8183 return result;
8173 } 8184 }
8174 8185
8175 @override 8186 @override
8176 void visitChildren(AstVisitor visitor) { 8187 void visitChildren(AstVisitor visitor) {
8177 // 8188 //
8178 // Note that subclasses are responsible for visiting the identifier because 8189 // Note that subclasses are responsible for visiting the identifier because
8179 // they often need to visit other nodes before visiting the identifier. 8190 // they often need to visit other nodes before visiting the identifier.
8180 // 8191 //
8181 if (_commentIsBeforeAnnotations()) { 8192 if (_commentIsBeforeAnnotations()) {
(...skipping 3255 matching lines...) Expand 10 before | Expand all | Expand 10 after
11437 11448
11438 @override 11449 @override
11439 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11450 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11440 visitor.visitYieldStatement(this); 11451 visitor.visitYieldStatement(this);
11441 11452
11442 @override 11453 @override
11443 void visitChildren(AstVisitor visitor) { 11454 void visitChildren(AstVisitor visitor) {
11444 _expression?.accept(visitor); 11455 _expression?.accept(visitor);
11445 } 11456 }
11446 } 11457 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698