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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 2722033002: Add an AST factory method for fieldDeclaration with all optional named parameters. (Closed)
Patch Set: Created 3 years, 10 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
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index c785abefddc635c43f31218ce587c73ec549a26a..e8bc7dd5d908187636ff18c9c417df3423376aa7 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -1338,15 +1338,13 @@ class Parser {
VariableDeclaration variable = astFactory.variableDeclaration(
createSyntheticIdentifier(), null, null);
List<VariableDeclaration> variables = <VariableDeclaration>[variable];
- FieldDeclarationImpl field = astFactory.fieldDeclaration(
- commentAndMetadata.comment,
- commentAndMetadata.metadata,
- null,
- astFactory.variableDeclarationList(
+ return astFactory.fieldDeclaration2(
+ comment: commentAndMetadata.comment,
+ metadata: commentAndMetadata.metadata,
+ covariantKeyword: modifiers.covariantKeyword,
+ fieldList: astFactory.variableDeclarationList(
null, null, keyword, null, variables),
- _expect(TokenType.SEMICOLON));
- field.covariantKeyword = modifiers.covariantKeyword;
- return field;
+ semicolon: _expect(TokenType.SEMICOLON));
}
_reportErrorForToken(
ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken);
@@ -3584,14 +3582,13 @@ class Parser {
TypeAnnotation type) {
VariableDeclarationList fieldList =
parseVariableDeclarationListAfterType(null, keyword, type);
- FieldDeclarationImpl field = astFactory.fieldDeclaration(
- commentAndMetadata.comment,
- commentAndMetadata.metadata,
- staticKeyword,
- fieldList,
- _expect(TokenType.SEMICOLON));
- field.covariantKeyword = covariantKeyword;
- return field;
+ return astFactory.fieldDeclaration2(
+ comment: commentAndMetadata.comment,
+ metadata: commentAndMetadata.metadata,
+ covariantKeyword: covariantKeyword,
+ staticKeyword: staticKeyword,
+ fieldList: fieldList,
+ semicolon: _expect(TokenType.SEMICOLON));
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698