[前][次][番号順一覧][スレッド一覧]

ruby-changes:49265

From: ko1 <ko1@a...>
Date: Thu, 21 Dec 2017 15:40:32 +0900 (JST)
Subject: [ruby-changes:49265] ko1:r61382 (trunk): add experimental API.

ko1	2017-12-21 15:40:28 +0900 (Thu, 21 Dec 2017)

  New Revision: 61382

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61382

  Log:
    add experimental API.
    
    * iseq.c (rb_iseq_code_range): added to access iseq's code range.

  Modified files:
    trunk/iseq.c
    trunk/iseq.h
Index: iseq.c
===================================================================
--- iseq.c	(revision 61381)
+++ iseq.c	(revision 61382)
@@ -771,6 +771,15 @@ rb_iseq_method_name(const rb_iseq_t *ise https://github.com/ruby/ruby/blob/trunk/iseq.c#L771
     }
 }
 
+void
+rb_iseq_code_range(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column)
+{
+    if (first_lineno) *first_lineno = iseq->body->location.code_range.first_loc.lineno;
+    if (first_column) *first_column = iseq->body->location.code_range.first_loc.column;
+    if (last_lineno) *last_lineno = iseq->body->location.code_range.last_loc.lineno;;
+    if (last_column) *last_column = iseq->body->location.code_range.last_loc.column;
+}
+
 VALUE
 rb_iseq_coverage(const rb_iseq_t *iseq)
 {
Index: iseq.h
===================================================================
--- iseq.h	(revision 61381)
+++ iseq.h	(revision 61382)
@@ -189,6 +189,7 @@ VALUE rb_iseq_label(const rb_iseq_t *ise https://github.com/ruby/ruby/blob/trunk/iseq.h#L189
 VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
 VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
 VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
+void rb_iseq_code_range(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column);
 
 /* proc.c */
 const rb_iseq_t *rb_method_iseq(VALUE body);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]