| 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) {
|
|
|