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

Unified Diff: pkg/front_end/lib/src/fasta/source/stack_listener.dart

Issue 2704753002: Implement line and column numbers. (Closed)
Patch Set: Change message. 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
Index: pkg/front_end/lib/src/fasta/source/stack_listener.dart
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
index 08f206920ffb597fd329a985062caefe3a0148ae..23d915588b113e03b5131915b7d25088306c64d8 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -16,6 +16,8 @@ import '../errors.dart' show inputError, internalError;
import '../quote.dart' show unescapeString;
+import '../messages.dart' as messages;
+
enum NullValue {
Arguments,
Block,
@@ -121,10 +123,10 @@ abstract class StackListener extends Listener {
debugEvent("Initializer");
}
- void checkEmpty() {
+ void checkEmpty(int charOffset) {
if (stack.isNotEmpty) {
- internalError("${runtimeType}: Stack not empty $uri:\n"
- " ${stack.join('\n ')}");
+ internalError("${runtimeType}: Stack not empty:\n"
+ " ${stack.join('\n ')}", uri, charOffset);
}
if (recoverableErrors.isNotEmpty) {
// TODO(ahe): Handle recoverable errors better.
@@ -135,13 +137,13 @@ abstract class StackListener extends Listener {
@override
void endTopLevelDeclaration(Token token) {
debugEvent("TopLevelDeclaration");
- checkEmpty();
+ checkEmpty(token.charOffset);
}
@override
void endCompilationUnit(int count, Token token) {
debugEvent("CompilationUnit");
- checkEmpty();
+ checkEmpty(token.charOffset);
}
@override
@@ -229,4 +231,12 @@ abstract class StackListener extends Listener {
Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) {
throw inputError(uri, token.charOffset, "$kind $arguments");
}
+
+ void nit(String message, [int charOffset = -1]) {
+ messages.nit(uri, charOffset, message);
+ }
+
+ void warning(String message, [int charOffset = -1]) {
+ messages.warning(uri, charOffset, message);
+ }
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_loader.dart ('k') | pkg/front_end/lib/src/fasta/target_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698