diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-14 10:53:53 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-14 10:53:53 +0000 |
commit | ad9473d604eef2d342a5a12ebe7fdafe3260217c (patch) | |
tree | 6f2a895bac75e382b9d4e71e1bb09f92cdafbc4b | |
parent | 4082c92ecd1f975cce3031ed602010999ca50566 (diff) | |
download | ruby-ad9473d604eef2d342a5a12ebe7fdafe3260217c.tar.gz ruby-ad9473d604eef2d342a5a12ebe7fdafe3260217c.tar.xz ruby-ad9473d604eef2d342a5a12ebe7fdafe3260217c.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@12930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | bootstraptest/test_exception.rb | 23 | ||||
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | eval_intern.h | 2 | ||||
-rw-r--r-- | ext/win32ole/win32ole.c | 2 | ||||
-rw-r--r-- | inits.c | 2 | ||||
-rw-r--r-- | insnhelper.h | 2 | ||||
-rw-r--r-- | proc.c | 2 |
8 files changed, 44 insertions, 8 deletions
@@ -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). diff --git a/bootstraptest/test_exception.rb b/bootstraptest/test_exception.rb index 79d7388b2..85ed94678 100644 --- a/bootstraptest/test_exception.rb +++ b/bootstraptest/test_exception.rb @@ -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]" + @@ -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); } diff --git a/eval_intern.h b/eval_intern.h index 7b89ed3da..8ee1625fc 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -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)); diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 42336e70a..efa57607e 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -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); @@ -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(); diff --git a/insnhelper.h b/insnhelper.h index 59536b2e7..4516a5525 100644 --- a/insnhelper.h +++ b/insnhelper.h @@ -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 */ @@ -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"); |