Class: Prism::NodeFind::LineBacktraceLocationFind
- Defined in:
- lib/prism/node_find.rb,
sig/generated/prism/node_find.rbs
Overview
Finds the AST node for a Thread::Backtrace::Location using best-effort line matching. Used on non-CRuby implementations.
Instance Method Summary collapse
-
#find(location) ⇒ Node?
Find the node for the given backtrace location by matching on line.
Instance Method Details
#find(location) ⇒ Node?
Find the node for the given backtrace location by matching on line.
: (Thread::Backtrace::Location location) -> Node?
206 207 208 209 210 211 212 |
# File 'lib/prism/node_find.rb', line 206 def find(location) file = location.absolute_path || location.path return unless (result = parse_file(file)) start_line = location.lineno result.value.find { |node| node.location.start_line == start_line } end |