diff options
author | Yusuke Endoh <[email protected]> | 2021-12-19 03:40:44 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2021-12-19 03:51:37 +0900 |
commit | acac2b8128980b97c64b4d057acdf2ceffb0b981 () | |
tree | bae29bfb63407ab9f9cccc3c57070ac99fdfe879 /vm_backtrace.c | |
parent | 7e0e6f90744ec89a87554d209fb797ddf7919319 (diff) |
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://.com/ruby/error_highlight/pull/16 The same check for proc/method has been already introduced since 64ac984129a7a4645efe5ac57c168ef880b479b2.
-rw-r--r-- | vm_backtrace.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -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) { #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); #else - *path = Qnil; #endif } static VALUE location_realpath(rb_backtrace_location_t *loc) { |