Skip to content

Commit

Permalink
* proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
ko1 committed Aug 14, 2007
1 parent 9cdeae9 commit 14c3aa5
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 8 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Tue Aug 14 19:53:15 2007 Koichi Sasada <[email protected]>

* 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 <[email protected]>

* common.mk: change test order (test -> btest).
Expand Down
23 changes: 23 additions & 0 deletions bootstraptest/test_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,26 @@ def m
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 changes: 6 additions & 1 deletion eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}


Expand Down
2 changes: 0 additions & 2 deletions eval_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion inits.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion insnhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 0 additions & 2 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 14c3aa5

Please sign in to comment.