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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser.dart

Issue 3007033002: report const class as a more specific error code (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.parser.parser; 5 library fasta.parser.parser;
6 6
7 import '../fasta_codes.dart' show Code, Message, Template; 7 import '../fasta_codes.dart' show Code, Message, Template;
8 8
9 import '../fasta_codes.dart' as fasta; 9 import '../fasta_codes.dart' as fasta;
10 10
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 token = token.next; 279 token = token.next;
280 } 280 }
281 if (token.isTopLevelKeyword) { 281 if (token.isTopLevelKeyword) {
282 Token abstractToken; 282 Token abstractToken;
283 Token modifierToken = start; 283 Token modifierToken = start;
284 while (modifierToken != token) { 284 while (modifierToken != token) {
285 if (optional('abstract', modifierToken) && 285 if (optional('abstract', modifierToken) &&
286 optional('class', token) && 286 optional('class', token) &&
287 abstractToken == null) { 287 abstractToken == null) {
288 abstractToken = modifierToken; 288 abstractToken = modifierToken;
289 } else if (optional('const', modifierToken) &&
290 optional('class', token)) {
291 reportRecoverableError(modifierToken, fasta.messageConstClass);
289 } else { 292 } else {
290 // TODO(danrubel): Report more specific recoverable error message
291 // for `const class` to better help the user.
292 // See ParserErrorCode CONST_CLASS
293
294 // Report an error for each extraneous modifier
295 reportRecoverableErrorWithToken( 293 reportRecoverableErrorWithToken(
296 modifierToken, fasta.templateExtraneousModifier); 294 modifierToken, fasta.templateExtraneousModifier);
297 } 295 }
298 modifierToken = modifierToken.next; 296 modifierToken = modifierToken.next;
299 } 297 }
300 return parseTopLevelKeywordDeclaration(abstractToken, token); 298 return parseTopLevelKeywordDeclaration(abstractToken, token);
301 } else if (token.isIdentifier || token.keyword != null) { 299 } else if (token.isIdentifier || token.keyword != null) {
302 // TODO(danrubel): improve parseTopLevelMember 300 // TODO(danrubel): improve parseTopLevelMember
303 // so that we don't parse modifiers twice. 301 // so that we don't parse modifiers twice.
304 return parseTopLevelMember(start); 302 return parseTopLevelMember(start);
(...skipping 3878 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 } 4181 }
4184 4182
4185 Token reportUnexpectedToken(Token token) { 4183 Token reportUnexpectedToken(Token token) {
4186 return reportUnrecoverableErrorWithToken( 4184 return reportUnrecoverableErrorWithToken(
4187 token, fasta.templateUnexpectedToken); 4185 token, fasta.templateUnexpectedToken);
4188 } 4186 }
4189 } 4187 }
4190 4188
4191 // TODO(ahe): Remove when analyzer supports generalized function syntax. 4189 // TODO(ahe): Remove when analyzer supports generalized function syntax.
4192 typedef _MessageWithArgument<T> = Message Function(T); 4190 typedef _MessageWithArgument<T> = Message Function(T);
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/messages.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698