[ruby/yarp] Add a Location#to method for combining them

https://github.com/ruby/yarp/commit/1db2de98ac
This commit is contained in:
Kevin Newton 2023-08-22 12:21:35 -04:00 committed by git
parent 55a8add304
commit 20cf9e3ae8

View File

@ -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