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

Unified Diff: pkg/analyzer/lib/src/generated/source.dart

Issue 229653004: New analyzer snapshot with MapIterator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
Index: pkg/analyzer/lib/src/generated/source.dart
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index 7dbcacd11e3e4018dbf86032e4a02395c35bc848..c38eb08fce848b268c2bc65e612e467ff2636be2 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -611,6 +611,15 @@ class SourceRange {
*/
SourceRange getTranslated(int delta) => new SourceRange(offset + delta, length);
+ /**
+ * @return the minimal [SourceRange] that cover this and the given [SourceRange]s.
+ */
+ SourceRange getUnion(SourceRange other) {
+ int newOffset = Math.min(offset, other.offset);
+ int newEnd = Math.max(offset + length, other.offset + other.length);
+ return new SourceRange(newOffset, newEnd - newOffset);
+ }
+
@override
int get hashCode => 31 * offset + length;
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/lib/src/generated/utilities_collection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698