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

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

Issue 2642683006: Get the rest of the shared tests for covariant to pass (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/src/dart/error/syntactic_errors.dart ('k') | pkg/analyzer/test/generated/parser_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 6446cfad53ec3a25858d2b46660d4e0d7fb5b851..c90af7d69f56ef2dadcf1fe42d92585ec695d120 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -4143,7 +4143,15 @@ class Parser {
Token covariantKeyword;
CommentAndMetadata commentAndMetadata = parseCommentAndMetadata();
if (_matchesKeyword(Keyword.COVARIANT)) {
- covariantKeyword = getAndAdvance();
+ // Check to ensure that 'covariant' isn't being used as the parameter name.
+ Token next = _peek();
+ if (_tokenMatchesKeyword(next, Keyword.FINAL) ||
+ _tokenMatchesKeyword(next, Keyword.CONST) ||
+ _tokenMatchesKeyword(next, Keyword.VAR) ||
+ _tokenMatchesKeyword(next, Keyword.THIS) ||
+ _tokenMatchesIdentifier(next)) {
+ covariantKeyword = getAndAdvance();
+ }
}
FinalConstVarOrType holder = parseFinalConstVarOrType(!inFunctionType,
inFunctionType: inFunctionType);
@@ -8332,6 +8340,10 @@ class Parser {
_reportErrorForToken(
ParserErrorCode.CONST_METHOD, modifiers.constKeyword);
}
+ if (modifiers.covariantKeyword != null) {
+ _reportErrorForToken(
+ ParserErrorCode.COVARIANT_MEMBER, modifiers.covariantKeyword);
+ }
if (modifiers.factoryKeyword != null) {
_reportErrorForToken(
ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword);
« no previous file with comments | « pkg/analyzer/lib/src/dart/error/syntactic_errors.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698