aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-07 05:12:08 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-07 05:12:08 +0000
commit12f368d6a48d7eb35a9c802d1ae4824b876f7c74 (patch)
tree21ad243d8a68f905cb34fa5e7c41531ab9485df5 /iseq.c
parent72db853bb825775b65e20af2b610c557426ed768 (diff)
downloadruby-12f368d6a48d7eb35a9c802d1ae4824b876f7c74.tar.gz
* iseq.c, internal.h: change to public (but internal) functions
* VALUE rb_iseq_path(VALUE iseqval); * VALUE rb_iseq_absolute_path(VALUE iseqval); * VALUE rb_iseq_label(VALUE iseqval); * VALUE rb_iseq_base_label(VALUE iseqval); * VALUE rb_iseq_first_lineno(VALUE iseqval); And new (temporary) function: * VALUE rb_iseq_klass(VALUE iseqval); * iseq.c. vm_core.h (int rb_iseq_first_lineno): remove function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'. Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead. * proc.c. vm_insnhelper.c, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/iseq.c b/iseq.c
index e600a4de6e..6336489861 100644
--- a/iseq.c
+++ b/iseq.c
@@ -842,8 +842,8 @@ iseq_inspect(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.path #=> /tmp/method.rb
*/
-static VALUE
-iseq_path(VALUE self)
+VALUE
+rb_iseq_path(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -866,8 +866,8 @@ iseq_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.absolute_path #=> /tmp/method.rb
*/
-static VALUE
-iseq_absolute_path(VALUE self)
+VALUE
+rb_iseq_absolute_path(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -897,8 +897,8 @@ iseq_absolute_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.label #=> <main>
*/
-static VALUE
-iseq_label(VALUE self)
+VALUE
+rb_iseq_label(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -925,8 +925,8 @@ iseq_label(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.base_label #=> <main>
*/
-static VALUE
-iseq_base_label(VALUE self)
+VALUE
+rb_iseq_base_label(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -943,14 +943,22 @@ iseq_base_label(VALUE self)
* iseq.first_lineno
* #=> 1
*/
-static VALUE
-iseq_first_lineno(VALUE self)
+VALUE
+rb_iseq_first_lineno(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
return iseq->location.first_lineno;
}
+VALUE
+rb_iseq_klass(VALUE self)
+{
+ rb_iseq_t *iseq;
+ GetISeqPtr(self, iseq);
+ return iseq->klass;
+}
+
static
VALUE iseq_data_to_ary(rb_iseq_t *iseq);
@@ -1047,12 +1055,6 @@ iseq_to_a(VALUE self)
return iseq_data_to_ary(iseq);
}
-int
-rb_iseq_first_lineno(const rb_iseq_t *iseq)
-{
- return FIX2INT(iseq->location.first_lineno);
-}
-
/* TODO: search algorithm is brute force.
this should be binary search or so. */
@@ -2259,11 +2261,11 @@ Init_ISeq(void)
rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
/* location APIs */
- rb_define_method(rb_cISeq, "path", iseq_path, 0);
- rb_define_method(rb_cISeq, "absolute_path", iseq_absolute_path, 0);
- rb_define_method(rb_cISeq, "label", iseq_label, 0);
- rb_define_method(rb_cISeq, "base_label", iseq_base_label, 0);
- rb_define_method(rb_cISeq, "first_lineno", iseq_first_lineno, 0);
+ rb_define_method(rb_cISeq, "path", rb_iseq_path, 0);
+ rb_define_method(rb_cISeq, "absolute_path", rb_iseq_absolute_path, 0);
+ rb_define_method(rb_cISeq, "label", rb_iseq_label, 0);
+ rb_define_method(rb_cISeq, "base_label", rb_iseq_base_label, 0);
+ rb_define_method(rb_cISeq, "first_lineno", rb_iseq_first_lineno, 0);
#if 0
/* Now, it is experimental. No discussions, no tests. */