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

Unified Diff: pkg/compiler/lib/src/io/source_file.dart

Issue 1415883011: Don't crash on error at end-of-file. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/io/source_file.dart
diff --git a/pkg/compiler/lib/src/io/source_file.dart b/pkg/compiler/lib/src/io/source_file.dart
index b07672edcd33ddc21bd5d01196ac334c7ca2b4ab..f2058ad02caefcf1486c09f1aef0070a2a6db4ea 100644
--- a/pkg/compiler/lib/src/io/source_file.dart
+++ b/pkg/compiler/lib/src/io/source_file.dart
@@ -137,6 +137,11 @@ abstract class SourceFile implements LineColumnProvider {
if (colorize == null) {
colorize = (text) => text;
}
+ if (end > length) {
ahe 2015/11/02 16:55:31 Add a TODO to turn this into an assertion. If you
ahe 2015/11/02 16:56:02 I meant to say: "consider adding a TODO..."
+ start = length - 1;
+ end = length;
+ }
+
int lineStart = getLine(start);
int columnStart = getColumn(lineStart, start);
int lineEnd = getLine(end);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698