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

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

Issue 2707973008: Fix some parser issues related to generic functin types (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 | « pkg/analyzer/lib/src/dart/error/syntactic_errors.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/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 2c5cafc18caf2d8684e484e35ed5027f5392cfd4..045a8c459e9414b1e3e4c2fbe478a522c485e653 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -3354,7 +3354,10 @@ class Parser {
TypeAnnotation functionType = parseTypeAnnotation(false);
Token semicolon = _expect(TokenType.SEMICOLON);
if (functionType is! GenericFunctionType) {
- // TODO(brianwilkerson) Generate an error and recover (better than this).
+ // TODO(brianwilkerson) Generate a better error.
+ _reportErrorForToken(
+ ParserErrorCode.INVALID_GENERIC_FUNCTION_TYPE, semicolon);
+ // TODO(brianwilkerson) Recover better than this.
return astFactory.genericTypeAlias(
commentAndMetadata.comment,
commentAndMetadata.metadata,
@@ -5632,7 +5635,7 @@ class Parser {
Token previous = startToken;
Token next = startToken.next;
while (next != previous) {
- if (_tokenMatches(startToken, TokenType.LT)) {
+ if (_tokenMatches(next, TokenType.LT)) {
depth++;
} else if (_tokenMatches(next, TokenType.GT)) {
depth--;
« no previous file with comments | « pkg/analyzer/lib/src/dart/error/syntactic_errors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698