class Prism::NodeFind::RubyVMBacktraceLocationFind - Documentation for Ruby 4.1
Description: class Prism::NodeFind::RubyVMBacktraceLocationFind: Location using the node_id from the backtrace location.
Keywords: ruby,class,Prism::NodeFind::RubyVMBacktraceLocationFind

🔍

No recent searches

# class Prism::NodeFind::RubyVMBacktraceLocationFind

Finds the AST node for a `Thread::Backtrace::Location` using the node_id from the backtrace location.

### Public Instance Methods

find (location)
Source

    # File lib/prism/node_find.rb, line 83
    def find(location)
      file = location.absolute_path || location.path
      return unless (result = parse_file(file))
      return unless RubyVM::AbstractSyntaxTree.respond_to?(:node_id_for_backtrace_location)

      node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location)

      result.value.find { |node| node.node_id == node_id }
    end

`Find` the node for the given backtrace location using node_id.