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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart

Issue 11092101: Diagnose unbalanced parentheses better. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 1 month 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 | « dart/sdk/lib/_internal/compiler/implementation/scanner/string_scanner.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart b/dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart
index a768b5038458be91960883793ce175f69e29d55d..573fc4f8dbc8a8ac8e9357c588cfbb3fb34380fc 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/scanner/token.dart
@@ -141,7 +141,15 @@ class Token implements Spannable {
/**
* The number of characters parsed by this token.
*/
- int get slowCharCount => slowToString().length;
+ int get slowCharCount {
+ if (info == BAD_INPUT_INFO) {
+ // This is a token that wraps around an error message. Return 1
+ // instead of the size of the length of the error message.
+ return 1;
+ } else {
+ return slowToString().length;
+ }
+ }
}
/**
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/scanner/string_scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698