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); |
+ } |
} |