Project

General

Profile

Actions

Feature #19083

closed

Add `node_id_for_backtrace_location` to ast.c

Added by eileencodes (Eileen Uchitelle) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:110513]

Description

Opening a ticket to get public comments on https://github.com/ruby/ruby/pull/6593. I worked on this with Aaron Patterson.

We want to use error highlight with eval'd code, specifically ERB templates. We're able to recover the generated code for eval'd templates and can get a parse tree for the ERB generated code, but we don't have a way to get the node id from the backtrace location. So we can't pass the right node into error highlight.

This patch gives us an API to get the node id from the backtrace location so we can find the node in the AST.

This change is needed for column info in ERB templates that Aaron worked on here https://github.com/rails/rails/pull/46171. Without this change we need to set RubyVM.keep_script_lines = true. With the changes here we should be able to remove keep_script_lines.


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0