File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -184,24 +184,14 @@ module Prism
184184 queue = [self] #: Array[Prism::node]
185185 result = [] #: Array[Prism::node]
186186
187+ line_offset = source.offsets[line - 1] #: Integer
188+ search_offset = line_offset + column
189+
187190 while (node = queue.shift)
188191 result < < node
189192
190193 node.compact_child_nodes.each do |child_node|
191- child_location = child_node.location
192-
193- start_line = child_location.start_line
194- end_line = child_location.end_line
195-
196- if start_line == end_line
197- if line == start_line && column > = child_location.start_column && column < child _location.end_column
198- queue < < child _node
199- break
200- end
201- elsif (line == start_line && column > = child_location.start_column) || (line == end_line && column < child _location.end_column)
202- queue < < child _node
203- break
204- elsif line > start_line && line < end _line
194+ if child_node.start_offset < = search_offset && search_offset < child _node.end_offset
205195 queue < < child _node
206196 break
207197 end
You can’t perform that action at this time.
0 commit comments