From 1942e9254744bc9629d2c7ea0e670e75051311de Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 23 Dec 2017 09:10:34 +0000 Subject: iseq.c: show first_lineno on iseq inspect My motivation was to improve the output of `ruby --dump=insns xxx.rb`. When one file has many iseqs, it's hard to find the one I want to read. So I wanted `iseq_disasm` to show first_lineno. I unified the behavior of `iseqw_disasm` for consistency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index a8895a562f..7282614806 100644 --- a/iseq.c +++ b/iseq.c @@ -1035,9 +1035,10 @@ iseqw_inspect(VALUE self) return rb_sprintf("#<%"PRIsVALUE": uninitialized>", klass); } else { - return rb_sprintf("<%"PRIsVALUE":%"PRIsVALUE"@%"PRIsVALUE">", + return rb_sprintf("<%"PRIsVALUE":%"PRIsVALUE"@%"PRIsVALUE":%d>", klass, - iseq->body->location.label, rb_iseq_path(iseq)); + iseq->body->location.label, rb_iseq_path(iseq), + FIX2INT(rb_iseq_first_lineno(iseq))); } } @@ -1661,7 +1662,9 @@ iseq_inspect(const rb_iseq_t *iseq) return rb_sprintf("#"); } else { - return rb_sprintf("#", RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(rb_iseq_path(iseq))); + return rb_sprintf("#", + RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(rb_iseq_path(iseq)), + FIX2INT(rb_iseq_first_lineno(iseq))); } } -- cgit v1.2.3