ruby-changes:69500
From: Nobuyoshi <ko1@a...>
Date: Fri, 29 Oct 2021 06:40:13 +0900 (JST)
Subject: [ruby-changes:69500] 9b751db99c (master): Fix script_lines in loaded iseq as nil
https://git.ruby-lang.org/ruby.git/commit/?id=9b751db99c From 9b751db99cb70c1f63e34f92955442167079d330 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 29 Oct 2021 01:03:29 +0900 Subject: Fix script_lines in loaded iseq as nil --- compile.c | 3 ++- test/ruby/test_iseq.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 62a047be78c..9d3b91beb72 100644 --- a/compile.c +++ b/compile.c @@ -11835,7 +11835,8 @@ ibf_load_iseq_each(struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset) https://github.com/ruby/ruby/blob/trunk/compile.c#L11835 ISEQ_COVERAGE_SET(iseq, Qnil); ISEQ_ORIGINAL_ISEQ_CLEAR(iseq); - iseq->body->variable.flip_count = variable_flip_count; + load_body->variable.flip_count = variable_flip_count; + load_body->variable.script_lines = Qnil; load_body->location.first_lineno = location_first_lineno; load_body->location.node_id = location_node_id; diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index edd131823e2..7125a5ac6d8 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -464,6 +464,11 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_iseq.rb#L464 a1 = iseq.to_a a2 = iseq2.to_a assert_equal(a1, a2, message(mesg) {diff iseq.disassemble, iseq2.disassemble}) + if iseq2.script_lines + assert_kind_of(Array, iseq2.script_lines) + else + assert_nil(iseq2.script_lines) + end iseq2 end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/