summaryrefslogtreecommitdiff
path: root/ast.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ast.rb')
-rw-r--r--ast.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/ast.rb b/ast.rb
index 24fd8e5526..1bc1168b80 100644
--- a/ast.rb
+++ b/ast.rb
@@ -67,6 +67,21 @@ module RubyVM::AbstractSyntaxTree
Primitive.ast_s_of body, keep_script_lines, error_tolerant
end
+ # call-seq:
+ # RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(backtrace_location) -> integer
+ #
+ # Returns the node id for the given backtrace location.
+ #
+ # begin
+ # raise
+ # rescue => e
+ # loc = e.backtrace_locations.first
+ # RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(loc)
+ # end # => 0
+ def self.node_id_for_backtrace_location backtrace_location
+ Primitive.node_id_for_backtrace_location backtrace_location
+ end
+
# RubyVM::AbstractSyntaxTree::Node instances are created by parse methods in
# RubyVM::AbstractSyntaxTree.
#