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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/dart/ast/ast.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/ast/ast.dart
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index a978f47c1326875ba979cdaae5606c9f119c9923..d157276a2a9b958e73be3113ce17bf478723b4e6 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -4322,6 +4322,11 @@ class ExtendsClauseImpl extends AstNodeImpl implements ExtendsClause {
*/
class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration {
/**
+ * The 'covariant' keyword, or `null` if the keyword was not used.
+ */
+ Token covariantKeyword;
+
+ /**
* The token representing the 'static' keyword, or `null` if the fields are
* not static.
*/
@@ -4371,7 +4376,9 @@ class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration {
@override
Token get firstTokenAfterCommentAndMetadata {
- if (staticKeyword != null) {
+ if (covariantKeyword != null) {
+ return covariantKeyword;
+ } else if (staticKeyword != null) {
return staticKeyword;
}
return _fieldList.beginToken;
@@ -4464,7 +4471,12 @@ class FieldFormalParameterImpl extends NormalFormalParameterImpl
@override
Token get beginToken {
- if (keyword != null) {
+ NodeList<Annotation> metadata = this.metadata;
+ if (!metadata.isEmpty) {
+ return metadata.beginToken;
+ } else if (covariantKeyword != null) {
+ return covariantKeyword;
+ } else if (keyword != null) {
return keyword;
} else if (_type != null) {
return _type.beginToken;
@@ -5574,7 +5586,12 @@ class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl
@override
Token get beginToken {
- if (_returnType != null) {
+ NodeList<Annotation> metadata = this.metadata;
+ if (!metadata.isEmpty) {
+ return metadata.beginToken;
+ } else if (covariantKeyword != null) {
+ return covariantKeyword;
+ } else if (_returnType != null) {
return _returnType.beginToken;
}
return identifier.beginToken;
@@ -9230,6 +9247,8 @@ class SimpleFormalParameterImpl extends NormalFormalParameterImpl
NodeList<Annotation> metadata = this.metadata;
if (!metadata.isEmpty) {
return metadata.beginToken;
+ } else if (covariantKeyword != null) {
+ return covariantKeyword;
} else if (keyword != null) {
return keyword;
} else if (_type != null) {
« 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