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

Unified Diff: lib/src/location.dart

Issue 1328613002: Fix a performance bug with FileLocation. (Closed) Base URL: git@github.com:dart-lang/source_span@master
Patch Set: update pubspec Created 5 years, 4 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/location.dart
diff --git a/lib/src/location.dart b/lib/src/location.dart
index 42e2b7dd78152a571ffca14321f1c042aed27af5..024c6e2780a340d4eddcc2cefa3094d6c95606b8 100644
--- a/lib/src/location.dart
+++ b/lib/src/location.dart
@@ -43,12 +43,12 @@ class SourceLocation implements Comparable<SourceLocation> {
offset = offset,
line = line == null ? 0 : line,
column = column == null ? offset : column {
- if (this.offset < 0) {
- throw new RangeError("Offset may not be negative, was ${this.offset}.");
- } else if (this.line < 0) {
- throw new RangeError("Line may not be negative, was ${this.line}.");
- } else if (this.column < 0) {
- throw new RangeError("Column may not be negative, was ${this.column}.");
+ if (offset < 0) {
+ throw new RangeError("Offset may not be negative, was $offset.");
+ } else if (line != null && line < 0) {
+ throw new RangeError("Line may not be negative, was $line.");
+ } else if (column != null && column < 0) {
+ throw new RangeError("Column may not be negative, was $column.");
}
}
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698