summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-13 12:06:14 +0000
committerwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-13 12:06:14 +0000
commitc8909ba6016524f1a857e8b1528471a3fd7aab76 (patch)
tree8b3534a075f189e2325bc580752477e9f0936151 /vm.c
parentc29206461f2d0c610eafed50e6658202aeb050ec (diff)
* vm.c (vm_exec): returning from lambda runs ensure section.
[Bug #1729] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/vm.c b/vm.c
index c84c0c8263..8a9fb046a1 100644
--- a/vm.c
+++ b/vm.c
@@ -1134,10 +1134,23 @@ vm_exec(rb_thread_t *th)
SET_THROWOBJ_STATE(err, state = TAG_BREAK);
}
else {
- result = GET_THROWOBJ_VAL(err);
- th->errinfo = Qnil;
- th->cfp += 2;
- goto finish_vme;
+ for (i = 0; i < cfp->iseq->catch_table_size; i++) {
+ entry = &cfp->iseq->catch_table[i];
+ if (entry->start < epc && entry->end >= epc) {
+ if (entry->type == CATCH_TYPE_ENSURE) {
+ catch_iseqval = entry->iseq;
+ cont_pc = entry->cont;
+ cont_sp = entry->sp;
+ break;
+ }
+ }
+ }
+ if (!catch_iseqval) {
+ result = GET_THROWOBJ_VAL(err);
+ th->errinfo = Qnil;
+ th->cfp += 2;
+ goto finish_vme;
+ }
}
/* through */
}