Chromium Code Reviews| Index: pkg/analyzer_plugin/lib/utilities/range_factory.dart |
| diff --git a/pkg/analyzer_plugin/lib/utilities/range_factory.dart b/pkg/analyzer_plugin/lib/utilities/range_factory.dart |
| index a875abf3f09f2d0c34b734ead7ddaf9024b68e70..feb3b7c416141ca80e2d31bd0e6263fe4bfbf06b 100644 |
| --- a/pkg/analyzer_plugin/lib/utilities/range_factory.dart |
| +++ b/pkg/analyzer_plugin/lib/utilities/range_factory.dart |
| @@ -81,6 +81,34 @@ class RangeFactory { |
| } |
| /** |
| + * Return a source range whose length is the same as the given [range], but |
| + * whose offset is the offset of the given [range] with [offset] added to it. |
| + */ |
| + SourceRange offsetBy(SourceRange range, int offset) { |
| + return new SourceRange(range.offset + offset, range.length); |
| + } |
| + |
| + /** |
| + * Return a source range that starts at the given [offset] and ends at the |
| + * given [endIndex]. |
| + */ |
| + SourceRange offsetEndIndex(int offset, int endIndex) { |
|
scheglov
2017/05/09 16:04:14
Drop "Index" for consistency with other methods, l
Brian Wilkerson
2017/05/09 16:51:56
So far, "end" means that 'end' will be invoked on
|
| + int length = endIndex - offset; |
| + return new SourceRange(offset, length); |
| + } |
| + |
| +// /** |
| +// * Return a source range that starts at the start of [leftEntity] and ends at |
| +// * the given [endIndex]. |
| +// */ |
| +// SourceRange startEndIndex( |
| +// SyntacticEntity leftEntity, int endIndex) { |
| +// int offset = leftEntity.offset; |
| +// int length = endIndex - offset; |
| +// return new SourceRange(offset, length); |
| +// } |
| + |
| + /** |
| * Return a source range that starts at the start of [leftEntity] and ends at |
| * the end of [rightEntity]. |
| */ |