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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2778213002: Use message.yaml in parser. (Closed)
Patch Set: Update subpackage relationships. Created 3 years, 9 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/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/lib/src/fasta/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 4f8e43e44d765f31c0698e5bd6d8b60d9eb84f39..41299e5de9f5160068a7cda09318c6235e4a4476 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -4,9 +4,10 @@
library fasta.body_builder;
-import '../parser/parser.dart' show FormalParameterType, optional;
+import '../fasta_codes.dart'
+ show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody;
-import '../parser/error_kind.dart' show ErrorKind;
+import '../parser/parser.dart' show FormalParameterType, optional;
import '../parser/identifier_context.dart' show IdentifierContext;
@@ -2343,29 +2344,26 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
}
@override
- void handleRecoverableError(Token token, ErrorKind kind, Map arguments) {
+ void handleRecoverableError(Token token, FastaMessage message) {
bool silent = hasParserError;
- super.handleRecoverableError(token, kind, arguments);
- addCompileTimeError(recoverableErrors.last.beginOffset,
- '${recoverableErrors.last.kind} $arguments',
- silent: silent);
+ super.handleRecoverableError(token, message);
+ addCompileTimeError(message.charOffset, message.message, silent: silent);
}
@override
- Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) {
- if (isDartLibrary && kind == ErrorKind.ExpectedFunctionBody) {
+ Token handleUnrecoverableError(Token token, FastaMessage message) {
+ if (isDartLibrary && message.code == codeExpectedFunctionBody) {
Token recover = skipNativeClause(token);
if (recover != null) return recover;
- } else if (kind == ErrorKind.UnexpectedToken) {
- String expected = arguments["expected"];
+ } else if (message.code == codeExpectedButGot) {
+ String expected = message.arguments["string"];
const List<String> trailing = const <String>[")", "}", ";", ","];
if (trailing.contains(token.stringValue) && trailing.contains(expected)) {
- arguments.putIfAbsent("actual", () => token.lexeme);
- handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments);
+ handleRecoverableError(token, message);
return newSyntheticToken(token);
}
}
- return super.handleUnrecoverableError(token, kind, arguments);
+ return super.handleUnrecoverableError(token, message);
}
@override
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta_codes_generated.dart ('k') | pkg/front_end/lib/src/fasta/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698