summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-23 09:37:01 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-23 09:37:01 +0000
commit4f7232fd2ea60b0689ed7fce4b1d07b42d2e35f8 (patch)
tree2ff6ba0f44a84652be10d110abf0ecb906bf6f9f /vm_insnhelper.c
parent03144f6df01df8b115436e5d916d3e5c3ed30212 (diff)
merges r29318 from trunk into ruby_1_9_2.
-- * vm_insnhelper.c (vm_cref_push): no outer cref is needed for proc from method. Bug #3786, Bug #3860, [ruby-core:32501] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 85c793999f..a73fb93714 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1053,21 +1053,23 @@ vm_getspecial(rb_thread_t *th, VALUE *lfp, VALUE key, rb_num_t type)
}
static NODE *
-vm_get_cref(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
+vm_get_cref0(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
{
- NODE *cref = 0;
-
while (1) {
if (lfp == dfp) {
- cref = iseq->cref_stack;
- break;
+ return iseq->cref_stack;
}
else if (dfp[-1] != Qnil) {
- cref = (NODE *)dfp[-1];
- break;
+ return (NODE *)dfp[-1];
}
dfp = GET_PREV_DFP(dfp);
}
+}
+
+static NODE *
+vm_get_cref(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
+{
+ NODE *cref = vm_get_cref0(iseq, lfp, dfp);
if (cref == 0) {
rb_bug("vm_get_cref: unreachable");
@@ -1084,10 +1086,10 @@ vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr)
cref->nd_visi = noex;
if (blockptr) {
- cref->nd_next = vm_get_cref(blockptr->iseq, blockptr->lfp, blockptr->dfp);
+ cref->nd_next = vm_get_cref0(blockptr->iseq, blockptr->lfp, blockptr->dfp);
}
else if (cfp) {
- cref->nd_next = vm_get_cref(cfp->iseq, cfp->lfp, cfp->dfp);
+ cref->nd_next = vm_get_cref0(cfp->iseq, cfp->lfp, cfp->dfp);
}
return cref;