diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 02:48:13 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 02:48:13 +0000 |
commit | c3f3d759553d42b3817c0e82828762a31f30c301 (patch) | |
tree | 4851f72f535acd79f520655c2cb3b4754eb8373e | |
parent | 430b88e65390aaa6867e91b1c467facd0d0e21b7 (diff) | |
download | ruby-c3f3d759553d42b3817c0e82828762a31f30c301.tar.gz ruby-c3f3d759553d42b3817c0e82828762a31f30c301.tar.xz ruby-c3f3d759553d42b3817c0e82828762a31f30c301.zip |
* compile.c (iseq_set_arguments), insnhelper.ci
(vm_callee_setup_arg, vm_yield_setup_args):
* bootstraptest/test_block.rb: add tests for above.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | bootstraptest/test_block.rb | 9 | ||||
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | insnhelper.ci | 9 |
4 files changed, 23 insertions, 4 deletions
@@ -1,3 +1,10 @@ +Sat Aug 18 11:44:59 2007 Koichi Sasada <ko1@atdot.net> + + * compile.c (iseq_set_arguments), insnhelper.ci + (vm_callee_setup_arg, vm_yield_setup_args): + + * bootstraptest/test_block.rb: add tests for above. + Sat Aug 18 01:12:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> * eval.c (frame_func_id): return proper method ID. diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb index 1d6a610bc..2e680b953 100644 --- a/bootstraptest/test_block.rb +++ b/bootstraptest/test_block.rb @@ -423,4 +423,13 @@ assert_equal '[0]', %q{ end m{|v, &b| v}.inspect }, '[ruby-dev:31440]' +assert_equal 'ok', %q{ + begin + lambda{|a|}.call(1, 2) + rescue ArgumentError + :ok + else + :ng + end +}, '[ruby-dev:31464]' @@ -904,7 +904,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 && iseq->arg_rest == -1) { if (iseq->argc == 1 && last_comma == 0) { /* {|a|} */ - iseq->arg_simple = 2; + iseq->arg_simple |= 0x02; } } } diff --git a/insnhelper.ci b/insnhelper.ci index 8f71703cb..292216373 100644 --- a/insnhelper.ci +++ b/insnhelper.ci @@ -103,7 +103,7 @@ vm_callee_setup_arg(rb_thread_t *th, rb_iseq_t *iseq, const int m = iseq->argc; const int orig_argc = argc; - if (iseq->arg_simple == 1) { + if (iseq->arg_simple & 0x01) { /* simple check */ if (argc != m) { rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", @@ -683,7 +683,9 @@ vm_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, * => {|a|} => a = [1, 2] * => {|a, b|} => a, b = [1, 2] */ - if (iseq->arg_simple != 2 && (m + iseq->arg_post_len) > 0 && argc == 1 && TYPE(argv[0]) == T_ARRAY) { + if (!(iseq->arg_simple & 0x02) && + (m + iseq->arg_post_len) > 0 && + argc == 1 && TYPE(argv[0]) == T_ARRAY) { VALUE ary = argv[0]; th->mark_stack_len = argc = RARRAY_LEN(ary); @@ -1316,7 +1318,8 @@ vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t throw_state, VAL th->state = GET_THROWOBJ_STATE(err); } else { - th->state = FIX2INT(rb_ivar_get(err, idThrowState)); + th->state = TAG_RAISE; + //th->state = FIX2INT(rb_ivar_get(err, idThrowState)); } return err; } |