зеркало из https://github.com/github/ruby.git
* vm_method.c (rb_method_defined_by): removed.
nobu pointed out that rb_method_basic_definition_p() is enough for last commit. * error.c, eval_error.c: change for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3dcebce523
Коммит
d5893b91fa
|
@ -1,3 +1,11 @@
|
||||||
|
Thu May 24 15:33:01 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_method.c (rb_method_defined_by): removed.
|
||||||
|
nobu pointed out that rb_method_basic_definition_p() is enough
|
||||||
|
for last commit.
|
||||||
|
|
||||||
|
* error.c, eval_error.c: change for above.
|
||||||
|
|
||||||
Thu May 24 14:30:13 2012 Koichi Sasada <ko1@atdot.net>
|
Thu May 24 14:30:13 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm.c: add RubyVM::Backtrace object (btobj).
|
* vm.c: add RubyVM::Backtrace object (btobj).
|
||||||
|
|
10
error.c
10
error.c
|
@ -717,10 +717,16 @@ rb_check_backtrace(VALUE bt)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
exc_set_backtrace(VALUE exc, VALUE bt)
|
||||||
|
{
|
||||||
|
return rb_iv_set(exc, "bt", rb_check_backtrace(bt));
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_exc_set_backtrace(VALUE exc, VALUE bt)
|
rb_exc_set_backtrace(VALUE exc, VALUE bt)
|
||||||
{
|
{
|
||||||
return rb_iv_set(exc, "bt", rb_check_backtrace(bt));
|
return exc_set_backtrace(exc, bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1678,7 +1684,7 @@ Init_Exception(void)
|
||||||
rb_define_method(rb_eException, "message", exc_message, 0);
|
rb_define_method(rb_eException, "message", exc_message, 0);
|
||||||
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
|
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
|
||||||
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
|
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
|
||||||
rb_define_method(rb_eException, "set_backtrace", rb_exc_set_backtrace, 1);
|
rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);
|
||||||
|
|
||||||
rb_eSystemExit = rb_define_class("SystemExit", rb_eException);
|
rb_eSystemExit = rb_define_class("SystemExit", rb_eException);
|
||||||
rb_define_method(rb_eSystemExit, "initialize", exit_initialize, -1);
|
rb_define_method(rb_eSystemExit, "initialize", exit_initialize, -1);
|
||||||
|
|
|
@ -55,13 +55,15 @@ rb_get_backtrace(VALUE info)
|
||||||
return get_backtrace(info);
|
return get_backtrace(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_backtrace(VALUE info, VALUE bt)
|
set_backtrace(VALUE info, VALUE bt)
|
||||||
{
|
{
|
||||||
ID set_backtrace = rb_intern("set_backtrace");
|
ID set_backtrace = rb_intern("set_backtrace");
|
||||||
|
|
||||||
if (rb_backtrace_p(bt)) {
|
if (rb_backtrace_p(bt)) {
|
||||||
if (rb_method_defined_by(info, set_backtrace, rb_exc_set_backtrace)) {
|
if (rb_method_basic_definition_p(CLASS_OF(info), set_backtrace)) {
|
||||||
rb_exc_set_backtrace(info, bt);
|
rb_exc_set_backtrace(info, bt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,6 @@ void rb_gc_mark_encodings(void);
|
||||||
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
|
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
|
||||||
VALUE rb_check_backtrace(VALUE);
|
VALUE rb_check_backtrace(VALUE);
|
||||||
NORETURN(void rb_async_bug_errno(const char *,int));
|
NORETURN(void rb_async_bug_errno(const char *,int));
|
||||||
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
|
|
||||||
|
|
||||||
/* eval_error.c */
|
/* eval_error.c */
|
||||||
void ruby_error_print(void);
|
void ruby_error_print(void);
|
||||||
|
|
16
vm_method.c
16
vm_method.c
|
@ -1401,19 +1401,3 @@ Init_eval_method(void)
|
||||||
REPLICATE_METHOD(rb_eException, respond_to_missing, NOEX_PUBLIC);
|
REPLICATE_METHOD(rb_eException, respond_to_missing, NOEX_PUBLIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS))
|
|
||||||
{
|
|
||||||
rb_method_entry_t *me = search_method(CLASS_OF(obj), mid);
|
|
||||||
|
|
||||||
if (me && me->def &&
|
|
||||||
me->def->type == VM_METHOD_TYPE_CFUNC &&
|
|
||||||
me->def->body.cfunc.func == cfunc) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче