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

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

Issue 2700183002: Re-enable generic function type support in analyzer (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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b8906c16e1f79006bf0d42ab493c05c7b2f21409..0ff0c33660353d916d766e22e642c781b634a203 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -249,12 +249,6 @@ class Parser {
bool _inInitializer = false;
/**
- * A flag indicating whether the parser is to parse generic function type
- * syntax.
- */
- bool parseGenericFunctionTypes = false;
-
- /**
* A flag indicating whether the parser is to parse generic method syntax.
*/
@deprecated
@@ -5057,24 +5051,21 @@ class Parser {
* | functionType
*/
TypeAnnotation parseTypeAnnotation(bool inExpression) {
- if (parseGenericFunctionTypes) {
- TypeAnnotation type = null;
- if (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
- // Generic function type with no return type.
- type = parseGenericFunctionTypeAfterReturnType(null);
- } else if (_currentToken.keyword == Keyword.VOID &&
- _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
- type = astFactory.typeName(
- astFactory.simpleIdentifier(getAndAdvance()), null);
- } else {
- type = parseTypeName(inExpression);
- }
- while (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
- type = parseGenericFunctionTypeAfterReturnType(type);
- }
- return type;
+ TypeAnnotation type = null;
+ if (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
+ // Generic function type with no return type.
+ type = parseGenericFunctionTypeAfterReturnType(null);
+ } else if (_currentToken.keyword == Keyword.VOID &&
+ _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
+ type = astFactory.typeName(
+ astFactory.simpleIdentifier(getAndAdvance()), null);
+ } else {
+ type = parseTypeName(inExpression);
+ }
+ while (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
+ type = parseGenericFunctionTypeAfterReturnType(type);
}
- return parseTypeName(inExpression);
+ return type;
}
/**
@@ -5535,22 +5526,19 @@ class Parser {
* This method must be kept in sync with [parseTypeAnnotation].
*/
Token skipTypeAnnotation(Token startToken) {
- if (parseGenericFunctionTypes) {
- Token next = null;
- if (_atGenericFunctionTypeAfterReturnType(startToken)) {
- next = skipGenericFunctionTypeAfterReturnType(startToken);
- } else if (_currentToken.keyword == Keyword.VOID &&
- _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
- next = next.next;
- } else {
- next = skipTypeName(startToken);
- }
- while (next != null && _tokenMatchesString(next, 'Function')) {
- next = skipGenericFunctionTypeAfterReturnType(next);
- }
- return next;
+ Token next = null;
+ if (_atGenericFunctionTypeAfterReturnType(startToken)) {
+ next = skipGenericFunctionTypeAfterReturnType(startToken);
+ } else if (_currentToken.keyword == Keyword.VOID &&
+ _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
+ next = next.next;
+ } else {
+ next = skipTypeName(startToken);
}
- return skipTypeName(startToken);
+ while (next != null && _atGenericFunctionTypeAfterReturnType(next)) {
+ next = skipGenericFunctionTypeAfterReturnType(next);
+ }
+ return next;
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698