Method: Prism::Location#join

Defined in:
lib/prism/parse_result.rb

#join(other) ⇒ Object

Returns a new location that stretches from this location to the given other location. Raises an error if this location is not before the other location or if they don’t share the same source.



132
133
134
135
136
137
# File 'lib/prism/parse_result.rb', line 132

def join(other)
  raise "Incompatible sources" if source != other.source
  raise "Incompatible locations" if start_offset > other.start_offset

  Location.new(source, start_offset, other.end_offset - start_offset)
end