* eval.c (proc_invoke): fix self switching in Proc#call

(ruby-bugs-ja#PR108) and GC failure.  use Qundef instead of 0
  to direct not switching self.

* eval.c (call_trace_func): ditto.

* eval.c (call_end_proc): ditto.

* eval.c (proc_call): ditto.

* eval.c (proc_yield): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2001-10-22 16:28:51 +00:00
Родитель 96baf2c092
Коммит 429f7ed113
2 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,17 @@
Tue Oct 23 01:21:19 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (proc_invoke): fix self switching in Proc#call
(ruby-bugs-ja#PR108) and GC failure. use Qundef instead of 0
to direct not switching self.
* eval.c (call_trace_func): ditto.
* eval.c (call_end_proc): ditto.
* eval.c (proc_call): ditto.
* eval.c (proc_yield): ditto.
Tue Oct 23 01:15:43 2001 K.Kosako <kosako@sofnec.co.jp> Tue Oct 23 01:15:43 2001 K.Kosako <kosako@sofnec.co.jp>
* variable.c (rb_global_entry): reconstruct global variable * variable.c (rb_global_entry): reconstruct global variable

10
eval.c
Просмотреть файл

@ -2018,7 +2018,7 @@ call_trace_func(event, file, line, self, id, klass)
id?ID2SYM(id):Qnil, id?ID2SYM(id):Qnil,
self?rb_f_binding(self):Qnil, self?rb_f_binding(self):Qnil,
klass), klass),
Qtrue, 0); Qtrue, Qundef);
} }
POP_TMPTAG(); /* do not propagate retval */ POP_TMPTAG(); /* do not propagate retval */
POP_FRAME(); POP_FRAME();
@ -5931,7 +5931,7 @@ call_end_proc(data)
ruby_frame->self = ruby_frame->prev->self; ruby_frame->self = ruby_frame->prev->self;
ruby_frame->last_func = 0; ruby_frame->last_func = 0;
ruby_frame->last_class = 0; ruby_frame->last_class = 0;
proc_invoke(data, rb_ary_new2(0), Qfalse, 0); proc_invoke(data, rb_ary_new2(0), Qfalse, Qundef);
POP_FRAME(); POP_FRAME();
POP_ITER(); POP_ITER();
} }
@ -6451,7 +6451,7 @@ proc_invoke(proc, args, pcall, self)
state = EXEC_TAG(); state = EXEC_TAG();
if (state == 0) { if (state == 0) {
proc_set_safe_level(proc); proc_set_safe_level(proc);
result = rb_yield_0(args, self, self?self:ruby_block->self, pcall); result = rb_yield_0(args, self, self!=Qundef?CLASS_OF(self):0, pcall);
} }
POP_TAG(); POP_TAG();
@ -6488,14 +6488,14 @@ static VALUE
proc_call(proc, args) proc_call(proc, args)
VALUE proc, args; /* OK */ VALUE proc, args; /* OK */
{ {
return proc_invoke(proc, args, Qtrue, 0); return proc_invoke(proc, args, Qtrue, Qundef);
} }
static VALUE static VALUE
proc_yield(proc, args) proc_yield(proc, args)
VALUE proc, args; /* OK */ VALUE proc, args; /* OK */
{ {
return proc_invoke(proc, args, Qfalse, 0); return proc_invoke(proc, args, Qfalse, Qundef);
} }
static VALUE static VALUE