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

Unified Diff: lib/src/file.dart

Issue 1328583002: Make the package strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/source_span@master
Patch Set: 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/file.dart
diff --git a/lib/src/file.dart b/lib/src/file.dart
index c180929f785e8698689c907c221b4013204d7ead..efd0da881b38bf076bae4254d42d4ce83de8c0f7 100644
--- a/lib/src/file.dart
+++ b/lib/src/file.dart
@@ -242,12 +242,17 @@ class _FileSpan extends SourceSpanMixin implements FileSpan {
SourceSpan union(SourceSpan other) {
if (other is! FileSpan) return super.union(other);
+
_FileSpan span = expand(other);
- var beginSpan = span._start == _start ? this : other;
- var endSpan = span._end == _end ? this : other;
- if (beginSpan._end < endSpan._start) {
- throw new ArgumentError("Spans $this and $other are disjoint.");
+ if (other is _FileSpan) {
+ if (this._start > other._end || other._start > this._end) {
+ throw new ArgumentError("Spans $this and $other are disjoint.");
+ }
+ } else {
+ if (this._start > other.end.offset || other.start.offset > this._end) {
+ throw new ArgumentError("Spans $this and $other are disjoint.");
+ }
}
return span;
« 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