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

Unified Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 2944383002: translate fasta parser error to analyzer error (Closed)
Patch Set: Created 3 years, 6 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/lib/src/generated/parser_fasta.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/fasta/ast_builder.dart
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 38d9d584da69ec9d1298057762949d7df99af973..b3896c96a8727f1d38e1b56e7093a83ddf815c77 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -18,7 +18,11 @@ import 'package:front_end/src/scanner/token.dart' as analyzer;
import 'package:front_end/src/fasta/errors.dart' show internalError;
import 'package:front_end/src/fasta/fasta_codes.dart'
- show FastaMessage, codeExpectedExpression, codeExpectedFunctionBody;
+ show
+ FastaCode,
+ FastaMessage,
+ codeExpectedExpression,
+ codeExpectedFunctionBody;
import 'package:front_end/src/fasta/kernel/kernel_builder.dart'
show Builder, KernelLibraryBuilder, ProcedureBuilder, Scope;
import 'package:front_end/src/fasta/parser/identifier_context.dart'
@@ -1918,6 +1922,15 @@ class AstBuilder extends ScopeListener {
@override
void addCompileTimeErrorFromMessage(FastaMessage message) {
+ FastaCode code = message.code;
+ switch (code.analyzerCode) {
+ case "EXPECTED_TYPE_NAME":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.EXPECTED_TYPE_NAME, message.charOffset, 1);
+ return;
+ default:
+ // fall through
+ }
library.addCompileTimeError(message.charOffset, message.message,
fileUri: message.uri);
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/parser_fasta.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698