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

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

Issue 2639323002: Add missing AST support for covariant keyword and fix bug from previous CL (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 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4315 } 4315 }
4316 4316
4317 /** 4317 /**
4318 * The declaration of one or more fields of the same type. 4318 * The declaration of one or more fields of the same type.
4319 * 4319 *
4320 * fieldDeclaration ::= 4320 * fieldDeclaration ::=
4321 * 'static'? [VariableDeclarationList] ';' 4321 * 'static'? [VariableDeclarationList] ';'
4322 */ 4322 */
4323 class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration { 4323 class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration {
4324 /** 4324 /**
4325 * The 'covariant' keyword, or `null` if the keyword was not used.
4326 */
4327 Token covariantKeyword;
4328
4329 /**
4325 * The token representing the 'static' keyword, or `null` if the fields are 4330 * The token representing the 'static' keyword, or `null` if the fields are
4326 * not static. 4331 * not static.
4327 */ 4332 */
4328 @override 4333 @override
4329 Token staticKeyword; 4334 Token staticKeyword;
4330 4335
4331 /** 4336 /**
4332 * The fields being declared. 4337 * The fields being declared.
4333 */ 4338 */
4334 VariableDeclarationList _fieldList; 4339 VariableDeclarationList _fieldList;
(...skipping 29 matching lines...) Expand all
4364 @override 4369 @override
4365 VariableDeclarationList get fields => _fieldList; 4370 VariableDeclarationList get fields => _fieldList;
4366 4371
4367 @override 4372 @override
4368 void set fields(VariableDeclarationList fields) { 4373 void set fields(VariableDeclarationList fields) {
4369 _fieldList = _becomeParentOf(fields as AstNodeImpl); 4374 _fieldList = _becomeParentOf(fields as AstNodeImpl);
4370 } 4375 }
4371 4376
4372 @override 4377 @override
4373 Token get firstTokenAfterCommentAndMetadata { 4378 Token get firstTokenAfterCommentAndMetadata {
4374 if (staticKeyword != null) { 4379 if (covariantKeyword != null) {
4380 return covariantKeyword;
4381 } else if (staticKeyword != null) {
4375 return staticKeyword; 4382 return staticKeyword;
4376 } 4383 }
4377 return _fieldList.beginToken; 4384 return _fieldList.beginToken;
4378 } 4385 }
4379 4386
4380 @override 4387 @override
4381 bool get isStatic => staticKeyword != null; 4388 bool get isStatic => staticKeyword != null;
4382 4389
4383 @override 4390 @override
4384 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 4391 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 TypeParameterListImpl typeParameters, 4464 TypeParameterListImpl typeParameters,
4458 FormalParameterListImpl parameters) 4465 FormalParameterListImpl parameters)
4459 : super(comment, metadata, identifier) { 4466 : super(comment, metadata, identifier) {
4460 _type = _becomeParentOf(type); 4467 _type = _becomeParentOf(type);
4461 _typeParameters = _becomeParentOf(typeParameters); 4468 _typeParameters = _becomeParentOf(typeParameters);
4462 _parameters = _becomeParentOf(parameters); 4469 _parameters = _becomeParentOf(parameters);
4463 } 4470 }
4464 4471
4465 @override 4472 @override
4466 Token get beginToken { 4473 Token get beginToken {
4467 if (keyword != null) { 4474 NodeList<Annotation> metadata = this.metadata;
4475 if (!metadata.isEmpty) {
4476 return metadata.beginToken;
4477 } else if (covariantKeyword != null) {
4478 return covariantKeyword;
4479 } else if (keyword != null) {
4468 return keyword; 4480 return keyword;
4469 } else if (_type != null) { 4481 } else if (_type != null) {
4470 return _type.beginToken; 4482 return _type.beginToken;
4471 } 4483 }
4472 return thisKeyword; 4484 return thisKeyword;
4473 } 4485 }
4474 4486
4475 @override 4487 @override
4476 Iterable<SyntacticEntity> get childEntities => super._childEntities 4488 Iterable<SyntacticEntity> get childEntities => super._childEntities
4477 ..add(keyword) 4489 ..add(keyword)
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
5567 FormalParameterListImpl parameters, 5579 FormalParameterListImpl parameters,
5568 this.question) 5580 this.question)
5569 : super(comment, metadata, identifier) { 5581 : super(comment, metadata, identifier) {
5570 _returnType = _becomeParentOf(returnType); 5582 _returnType = _becomeParentOf(returnType);
5571 _typeParameters = _becomeParentOf(typeParameters); 5583 _typeParameters = _becomeParentOf(typeParameters);
5572 _parameters = _becomeParentOf(parameters); 5584 _parameters = _becomeParentOf(parameters);
5573 } 5585 }
5574 5586
5575 @override 5587 @override
5576 Token get beginToken { 5588 Token get beginToken {
5577 if (_returnType != null) { 5589 NodeList<Annotation> metadata = this.metadata;
5590 if (!metadata.isEmpty) {
5591 return metadata.beginToken;
5592 } else if (covariantKeyword != null) {
5593 return covariantKeyword;
5594 } else if (_returnType != null) {
5578 return _returnType.beginToken; 5595 return _returnType.beginToken;
5579 } 5596 }
5580 return identifier.beginToken; 5597 return identifier.beginToken;
5581 } 5598 }
5582 5599
5583 @override 5600 @override
5584 Iterable<SyntacticEntity> get childEntities => 5601 Iterable<SyntacticEntity> get childEntities =>
5585 super._childEntities..add(_returnType)..add(identifier)..add(parameters); 5602 super._childEntities..add(_returnType)..add(identifier)..add(parameters);
5586 5603
5587 @override 5604 @override
(...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after
9223 this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier) 9240 this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier)
9224 : super(comment, metadata, identifier) { 9241 : super(comment, metadata, identifier) {
9225 _type = _becomeParentOf(type); 9242 _type = _becomeParentOf(type);
9226 } 9243 }
9227 9244
9228 @override 9245 @override
9229 Token get beginToken { 9246 Token get beginToken {
9230 NodeList<Annotation> metadata = this.metadata; 9247 NodeList<Annotation> metadata = this.metadata;
9231 if (!metadata.isEmpty) { 9248 if (!metadata.isEmpty) {
9232 return metadata.beginToken; 9249 return metadata.beginToken;
9250 } else if (covariantKeyword != null) {
9251 return covariantKeyword;
9233 } else if (keyword != null) { 9252 } else if (keyword != null) {
9234 return keyword; 9253 return keyword;
9235 } else if (_type != null) { 9254 } else if (_type != null) {
9236 return _type.beginToken; 9255 return _type.beginToken;
9237 } 9256 }
9238 return identifier.beginToken; 9257 return identifier.beginToken;
9239 } 9258 }
9240 9259
9241 @override 9260 @override
9242 Iterable<SyntacticEntity> get childEntities => 9261 Iterable<SyntacticEntity> get childEntities =>
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
11448 11467
11449 @override 11468 @override
11450 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11469 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11451 visitor.visitYieldStatement(this); 11470 visitor.visitYieldStatement(this);
11452 11471
11453 @override 11472 @override
11454 void visitChildren(AstVisitor visitor) { 11473 void visitChildren(AstVisitor visitor) {
11455 _expression?.accept(visitor); 11474 _expression?.accept(visitor);
11456 } 11475 }
11457 } 11476 }
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