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

Unified Diff: sdk/lib/core/exceptions.dart

Issue 2789523002: Fix edge cases where a FormatException source argument starts with a newline. (Closed)
Patch Set: Rename variables. Created 3 years, 9 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 | tests/corelib/format_exception_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/exceptions.dart
diff --git a/sdk/lib/core/exceptions.dart b/sdk/lib/core/exceptions.dart
index 8fb50fdbf1324ab050522cc1bb2f94d337e6b820..aacddea7b2b0b56814a3f18873b401e5b850b4d3 100644
--- a/sdk/lib/core/exceptions.dart
+++ b/sdk/lib/core/exceptions.dart
@@ -116,19 +116,19 @@ class FormatException implements Exception {
}
int lineNum = 1;
int lineStart = 0;
- bool lastWasCR;
+ bool previousCharWasCR = false;
for (int i = 0; i < offset; i++) {
int char = source.codeUnitAt(i);
if (char == 0x0a) {
- if (lineStart != i || !lastWasCR) {
+ if (lineStart != i || !previousCharWasCR) {
lineNum++;
}
lineStart = i + 1;
- lastWasCR = false;
+ previousCharWasCR = false;
} else if (char == 0x0d) {
lineNum++;
lineStart = i + 1;
- lastWasCR = true;
+ previousCharWasCR = true;
}
}
if (lineNum > 1) {
« no previous file with comments | « no previous file | tests/corelib/format_exception_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698