summaryrefslogtreecommitdiff
path: root/lib/prism/parse_result.rb
diff options
context:
space:
mode:
authorGopal Patel <[email protected]>2024-01-08 10:31:37 -0800
committergit <[email protected]>2024-02-24 03:39:22 +0000
commit7556fd937cfedbee9775b92124fcdce5c416dd50 ()
tree55bca2cd9e0dce4543c8e086bda52d3c2158e1a6 /lib/prism/parse_result.rb
parente03e9c3644c3c5a8713e1fed547da0c0becf36de (diff)
[ruby/prism] Split private types
https://.com/ruby/prism/commit/0209d093ec
-rw-r--r--lib/prism/parse_result.rb12
1 files changed, 4 insertions, 8 deletions
@@ -30,7 +30,7 @@ module Prism
# Perform a byteslice on the source code using the given byte offset and
# byte length.
def slice(byte_offset, length)
- source.byteslice(byte_offset, length)
end
# Binary search through the offsets to find the line number for the given
@@ -52,7 +52,7 @@ module Prism
# Return the character offset for the given byte offset.
def character_offset(byte_offset)
- source.byteslice(0, byte_offset).length
end
# Return the column number in characters for the given byte offset.
@@ -157,12 +157,8 @@ module Prism
end
# Create a new location object with the given options.
- def copy(**options)
- Location.new(
- options.fetch(:source) { source },
- options.fetch(:start_offset) { start_offset },
- options.fetch(:length) { length }
- )
end
# Returns a string representation of this location.