Merge remote-tracking branch 'origin/topic/jsiwek/ticket946'

Closes #946.

* origin/topic/jsiwek/ticket946:
  Fix memory leaks resulting from 'when' and 'return when' statements.
  Fix three bugs with 'when' and 'return when' statements. Addresses #946
This commit is contained in:
Robin Sommer 2013-03-06 15:08:06 -08:00
commit d931079021
17 changed files with 265 additions and 70 deletions

View file

@ -4639,12 +4639,16 @@ Val* CallExpr::Eval(Frame* f) const
{
const ::Func* func = func_val->AsFunc();
calling_expr = this;
const CallExpr* current_call = f ? f->GetCall() : 0;
if ( f )
f->SetCall(this);
ret = func->Call(v, f); // No try/catch here; we pass exceptions upstream.
if ( f )
f->ClearCall();
f->SetCall(current_call);
// Don't Unref() the arguments, as Func::Call already did that.
delete v;