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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java

Issue 10823372: 'Inline Method' refactoring (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java
index a2271beae79800316c974c8387636d3ef738782f..69607c79b83a75e81b013dca87c4772a2fc9e029 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/SourceRangeFactory.java
@@ -111,6 +111,10 @@ public class SourceRangeFactory {
return new SourceRangeImpl(start, length);
}
+ public static SourceRange forStartLength(SourceRange a, int length) {
+ return forStartLength(a.getOffset(), length);
+ }
+
/**
* @return the {@link SourceRange} which start at start of "a" and ends at start of "b".
*/
@@ -142,6 +146,22 @@ public class SourceRangeFactory {
}
/**
+ * @return the {@link SourceRange} of "a" with offset from given "base".
+ */
+ public static SourceRange fromBase(HasSourceInfo a, SourceRange base) {
+ return fromBase(a, base.getOffset());
+ }
+
+ /**
+ * @return the {@link SourceRange} "a" with offset from given "base".
+ */
+ public static SourceRange fromBase(SourceRange a, SourceRange base) {
+ int start = a.getOffset() - base.getOffset();
+ int length = a.getLength();
+ return forStartLength(start, length);
+ }
+
+ /**
* Given {@link SourceRange} created relative to "base", return absolute {@link SourceRange}.
*/
public static SourceRange withBase(HasSourceInfo base, SourceRange r) {

Powered by Google App Engine
This is Rietveld 408576698