summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-12-19 03:40:44 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-12-19 03:51:37 +0900
commitacac2b8128980b97c64b4d057acdf2ceffb0b981 (patch)
treebae29bfb63407ab9f9cccc3c57070ac99fdfe879 /vm_backtrace.c
parent7e0e6f90744ec89a87554d209fb797ddf7919319 (diff)
downloadruby-acac2b8128980b97c64b4d057acdf2ceffb0b981.tar.gz
Make RubyVM::AbstractSyntaxTree.of raise for backtrace location in eval
This check is needed to fix a bug of error_highlight when NameError occurred in eval'ed code. https://github.com/ruby/error_highlight/pull/16 The same check for proc/method has been already introduced since 64ac984129a7a4645efe5ac57c168ef880b479b2.
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index f2e9bed6ba..02c2ff4abd 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -333,20 +333,25 @@ location_node_id(rb_backtrace_location_t *loc)
}
#endif
-void
-rb_frame_info_get(VALUE obj, VALUE *path, VALUE *script_lines, int *node_id)
+int
+rb_get_node_id_from_frame_info(VALUE obj)
{
#ifdef USE_ISEQ_NODE_ID
rb_backtrace_location_t *loc = location_ptr(obj);
- const rb_iseq_t *iseq = location_iseq(loc);
- *path = iseq ? rb_iseq_path(iseq) : Qnil;
- *script_lines = iseq ? iseq->body->variable.script_lines : Qnil;
- *node_id = location_node_id(loc);
+ return location_node_id(loc);
#else
- *path = Qnil;
+ return -1;
#endif
}
+const rb_iseq_t *
+rb_get_iseq_from_frame_info(VALUE obj)
+{
+ rb_backtrace_location_t *loc = location_ptr(obj);
+ const rb_iseq_t *iseq = location_iseq(loc);
+ return iseq;
+}
+
static VALUE
location_realpath(rb_backtrace_location_t *loc)
{