summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/yarp.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/yarp.rb b/lib/yarp.rb
index f43aaa3d12..4c3cf268ce 100644
--- a/lib/yarp.rb
+++ b/lib/yarp.rb
@@ -112,6 +112,11 @@ module YARP
other.end_offset == end_offset
end
+ # Returns a new location that is the union of this location and the other.
+ def to(other)
+ Location.new(source, start_offset, other.end_offset - start_offset)
+ end
+
def self.null
new(0, 0)
end