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

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

Issue 2714843002: Add NormalFormalParameter.covariantKeyword setter and factory parameter. (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 045a8c459e9414b1e3e4c2fbe478a522c485e653..0170d362cebbb3b049ae8d13d2998e1f75c9bfe8 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4163,14 +4163,13 @@ class Parser {
period = _expect(TokenType.PERIOD);
}
if (!_matchesIdentifier() && inFunctionType) {
- SimpleFormalParameterImpl parameter = astFactory.simpleFormalParameter(
+ return astFactory.simpleFormalParameter(
commentAndMetadata.comment,
commentAndMetadata.metadata,
+ covariantKeyword,
holder.keyword,
holder.type,
null);
- parameter.covariantKeyword = covariantKeyword;
- return parameter;
}
SimpleIdentifier identifier = parseSimpleIdentifier();
TypeParameterList typeParameters = _parseGenericMethodTypeParameters();
@@ -4185,22 +4184,20 @@ class Parser {
if (enableNnbd && _matches(TokenType.QUESTION)) {
question = getAndAdvance();
}
- FunctionTypedFormalParameterImpl parameter =
- astFactory.functionTypedFormalParameter(
- commentAndMetadata.comment,
- commentAndMetadata.metadata,
- holder.type,
- astFactory.simpleIdentifier(identifier.token,
- isDeclaration: true),
- typeParameters,
- parameters,
- question: question);
- parameter.covariantKeyword = covariantKeyword;
- return parameter;
+ return astFactory.functionTypedFormalParameter(
+ commentAndMetadata.comment,
+ commentAndMetadata.metadata,
+ covariantKeyword,
+ holder.type,
+ astFactory.simpleIdentifier(identifier.token, isDeclaration: true),
+ typeParameters,
+ parameters,
+ question: question);
} else {
- FieldFormalParameterImpl parameter = astFactory.fieldFormalParameter(
+ return astFactory.fieldFormalParameter(
commentAndMetadata.comment,
commentAndMetadata.metadata,
+ covariantKeyword,
holder.keyword,
holder.type,
thisKeyword,
@@ -4208,8 +4205,6 @@ class Parser {
identifier,
typeParameters,
parameters);
- parameter.covariantKeyword = covariantKeyword;
- return parameter;
}
} else if (typeParameters != null) {
// TODO(brianwilkerson) Report an error. It looks like a function-typed
@@ -4231,9 +4226,10 @@ class Parser {
// TODO(brianwilkerson) If there are type parameters but no parameters,
// should we create a synthetic empty parameter list here so we can
// capture the type parameters?
- FieldFormalParameterImpl parameter = astFactory.fieldFormalParameter(
+ return astFactory.fieldFormalParameter(
commentAndMetadata.comment,
commentAndMetadata.metadata,
+ covariantKeyword,
holder.keyword,
type,
thisKeyword,
@@ -4241,17 +4237,14 @@ class Parser {
identifier,
null,
null);
- parameter.covariantKeyword = covariantKeyword;
- return parameter;
}
- SimpleFormalParameterImpl parameter = astFactory.simpleFormalParameter(
+ return astFactory.simpleFormalParameter(
commentAndMetadata.comment,
commentAndMetadata.metadata,
+ covariantKeyword,
holder.keyword,
type,
astFactory.simpleIdentifier(identifier.token, isDeclaration: true));
- parameter.covariantKeyword = covariantKeyword;
- return parameter;
}
/**

Powered by Google App Engine
This is Rietveld 408576698