Skip to content

Commit

Permalink
Trap returns through a define_method {}
Browse files Browse the repository at this point in the history
This code is a bit suspect. It should probably check the return is for
it...
  • Loading branch information
Evan Phoenix committed Nov 12, 2009
1 parent 30c120b commit 5fa4878
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion vm/builtin/block_as_method.cpp
Expand Up @@ -46,6 +46,19 @@ namespace rubinius {

invocation.module = msg.module;

return (*bm->block_env()->execute)(state, call_frame, bm->block_env(), args, invocation);
Object* ret = (*bm->block_env()->execute)(state, call_frame,
bm->block_env(), args, invocation);

if(!ret) {
RaiseReason reason = state->thread_state()->raise_reason();
if(reason == cReturn || reason == cBreak) {
// TODO investigate if we should check the destination_scope here.
// It doesn't appear that MRI checks anything similar.
ret = state->thread_state()->raise_value();
state->thread_state()->clear_exception(true);
}
}

return ret;
}
}

0 comments on commit 5fa4878

Please sign in to comment.