mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
72db853bb8
commit
12f368d6a4
7 changed files with 51 additions and 27 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Mon Oct 7 14:07:45 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* 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.
|
||||
|
||||
Sun Oct 6 08:37:39 2013 Zachary Scott <e@zzak.io>
|
||||
|
||||
* lib/webrick.rb: [DOC] fix grammar in WEBrick overview [Fixes GH-413]
|
||||
|
|
|
@ -449,6 +449,12 @@ VALUE rb_io_flush_raw(VALUE, int);
|
|||
|
||||
/* iseq.c */
|
||||
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
|
||||
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);
|
||||
VALUE rb_iseq_klass(VALUE iseqval); /* completely temporary fucntion */
|
||||
|
||||
/* load.c */
|
||||
VALUE rb_get_load_path(void);
|
||||
|
|
44
iseq.c
44
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. */
|
||||
|
|
6
proc.c
6
proc.c
|
@ -924,7 +924,7 @@ iseq_location(rb_iseq_t *iseq)
|
|||
if (!iseq) return Qnil;
|
||||
loc[0] = iseq->location.path;
|
||||
if (iseq->line_info_table) {
|
||||
loc[1] = INT2FIX(rb_iseq_first_lineno(iseq));
|
||||
loc[1] = INT2FIX(rb_iseq_first_lineno(iseq->self));
|
||||
}
|
||||
else {
|
||||
loc[1] = Qnil;
|
||||
|
@ -1038,7 +1038,7 @@ proc_to_s(VALUE self)
|
|||
int first_lineno = 0;
|
||||
|
||||
if (iseq->line_info_table) {
|
||||
first_lineno = rb_iseq_first_lineno(iseq);
|
||||
first_lineno = rb_iseq_first_lineno(iseq->self);
|
||||
}
|
||||
str = rb_sprintf("#<%s:%p@%"PRIsVALUE":%d%s>", cname, (void *)self,
|
||||
iseq->location.path, first_lineno, is_lambda);
|
||||
|
@ -2382,7 +2382,7 @@ proc_binding(VALUE self)
|
|||
bind->env = proc->envval;
|
||||
if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
|
||||
bind->path = proc->block.iseq->location.path;
|
||||
bind->first_lineno = rb_iseq_first_lineno(proc->block.iseq);
|
||||
bind->first_lineno = rb_iseq_first_lineno(proc->block.iseq->self);
|
||||
}
|
||||
else {
|
||||
bind->path = Qnil;
|
||||
|
|
|
@ -666,7 +666,6 @@ VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VA
|
|||
VALUE rb_iseq_disasm(VALUE self);
|
||||
int rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child);
|
||||
const char *ruby_node_name(int node);
|
||||
int rb_iseq_first_lineno(const rb_iseq_t *iseq);
|
||||
|
||||
RUBY_EXTERN VALUE rb_cISeq;
|
||||
RUBY_EXTERN VALUE rb_cRubyVM;
|
||||
|
|
|
@ -131,7 +131,7 @@ argument_error(const rb_iseq_t *iseq, int miss_argc, int min_argc, int max_argc)
|
|||
VALUE err_line = 0;
|
||||
|
||||
if (iseq) {
|
||||
int line_no = rb_iseq_first_lineno(iseq);
|
||||
int line_no = rb_iseq_first_lineno(iseq->self);
|
||||
|
||||
err_line = rb_sprintf("%s:%d:in `%s'",
|
||||
RSTRING_PTR(iseq->location.path),
|
||||
|
|
|
@ -290,7 +290,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
|
|||
break;
|
||||
}
|
||||
if (iseq && !NIL_P(iseq->location.path)) {
|
||||
int line = iseq->line_info_table ? rb_iseq_first_lineno(iseq) : 0;
|
||||
int line = iseq->line_info_table ? rb_iseq_first_lineno(iseq->self) : 0;
|
||||
rb_compile_warning(RSTRING_PTR(iseq->location.path), line,
|
||||
"previous definition of %s was here",
|
||||
rb_id2name(old_def->original_id));
|
||||
|
|
Loading…
Add table
Reference in a new issue