Skip to content

Commit f004e7d

Browse files
committed
Remove currently-unused Prism::Source#line_and_character_column_to_byte_offset
1 parent 8a02eed commit f004e7d

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

lib/prism/parse_result.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,6 @@ def code_units_column(byte_offset, encoding)
152152
code_units_offset(byte_offset, encoding) - code_units_offset(line_start(byte_offset), encoding)
153153
end
154154

155-
# Returns the byte offset for a given line number and column number
156-
def line_and_character_column_to_byte_offset(line, column)
157-
line_start = line_to_byte_offset(line)
158-
line_end = offsets[line + 1 - @start_line] || source.bytesize
159-
byteslice = @source.byteslice(line_start, line_end) or raise ArgumentError, "line #{line} is out of range"
160-
byte_column = (byteslice[0...column] or raise).bytesize
161-
line_start + byte_column
162-
end
163-
164155
# Freeze this object and the objects it contains.
165156
def deep_freeze
166157
source.freeze
@@ -290,12 +281,6 @@ def code_units_cache(encoding)
290281
def code_units_column(byte_offset, encoding)
291282
byte_offset - line_start(byte_offset)
292283
end
293-
294-
# Specialized version of `line_and_character_column_to_byte_offset`
295-
# which does not need to access the source String
296-
def line_and_character_column_to_byte_offset(line, column)
297-
line_to_byte_offset(line) + column
298-
end
299284
end
300285

301286
# This represents a location in the source.

sig/prism/parse_result.rbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module Prism
2525
def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
2626
def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
2727
def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
28-
def line_and_character_column_to_byte_offset: (Integer line, Integer column) -> Integer
2928
def deep_freeze: () -> void
3029

3130
def self.for: (String source) -> Source
@@ -42,7 +41,6 @@ module Prism
4241
def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
4342
def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
4443
def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
45-
def line_and_character_column_to_byte_offset: (Integer line, Integer column) -> Integer
4644
end
4745

4846
class Location

0 commit comments

Comments
 (0)