1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move

init place of exception_error.
* inits.c: ditto.
* eval.c (Init_eval): set exception_error#throwed_state as TAG_FATAL.
  [ruby-dev:31407]
* bootstraptest/test_exception.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-08-14 10:53:53 +00:00
parent 9cdeae9dad
commit 14c3aa52ae
8 changed files with 44 additions and 8 deletions

View file

@ -1,3 +1,15 @@
Tue Aug 14 19:53:15 2007 Koichi Sasada <ko1@atdot.net>
* proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move
init place of exception_error.
* inits.c: ditto.
* eval.c (Init_eval): set exception_error#throwed_state as TAG_FATAL.
[ruby-dev:31407]
* bootstraptest/test_exception.rb: add a test for above.
Tue Aug 14 19:51:20 2007 Koichi Sasada <ko1@atdot.net>
* common.mk: change test order (test -> btest).

View file

@ -368,3 +368,26 @@ assert_equal %q{}, %q{
end
end.call
}
##
assert_equal "ok", %q{
$foo = "ok"
class C
def inspect
bar {}
$foo = "ng"
end
def bar
raise
ensure
end
end
begin
C.new.foo
rescue NoMethodError => e
$foo
end
}, "[ruby-dev:31407]"

7
eval.c
View file

@ -29,9 +29,10 @@ static ID object_id, __send, __send_bang, respond_to;
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
VALUE exception_error;
VALUE sysstack_error;
static VALUE exception_error;
static VALUE eval(VALUE, VALUE, VALUE, const char *, int);
static inline VALUE rb_yield_0(int argc, VALUE *argv);
@ -2726,6 +2727,10 @@ Init_eval(void)
rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
rb_define_virtual_variable("$SAFE", safe_getter, safe_setter);
exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
rb_ivar_set(exception_error, idThrowState, INT2FIX(TAG_FATAL));
rb_register_mark_object(exception_error);
}

View file

@ -177,8 +177,6 @@ char *strrchr _((const char *, const char));
ruby_cref()->nd_visi = (f); \
}
extern VALUE exception_error;
void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void));

View file

@ -2014,7 +2014,7 @@ typelib_file_from_typelib(VALUE ole)
if (ver == Qnil)
break;
err = reg_open_vkey(hclsid, ver, &hversion);
if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
continue;
fver = atof(StringValuePtr(ver));
typelib = reg_get_val(hversion, NULL);

View file

@ -63,10 +63,10 @@ rb_call_inits()
Init_Comparable();
Init_Enumerable();
Init_Precision();
Init_Exception();
Init_eval();
Init_jump();
Init_String();
Init_Exception();
Init_Numeric();
Init_Bignum();
Init_syserr();

View file

@ -62,7 +62,7 @@
#define GET_OPERAND(n) (GET_PC()[(n)])
#define ADD_PC(n) (SET_PC(REG_PC + (n)))
#define GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
#define GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
#define JUMP(dst) (REG_PC += (dst))
/* FP */

2
proc.c
View file

@ -1443,8 +1443,6 @@ Init_Proc(void)
rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError);
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
rb_register_mark_object(exception_error);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eException);
sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");