GH-210: improve call stack tracking

Adds tracking of arguments
This commit is contained in:
Jon Siwek 2019-01-28 14:11:19 -06:00
parent 253adfd14b
commit 3e2c2a6140
7 changed files with 64 additions and 31 deletions

View file

@ -4839,28 +4839,17 @@ Val* CallExpr::Eval(Frame* f) const
{
const ::Func* func = func_val->AsFunc();
const CallExpr* current_call = f ? f->GetCall() : 0;
call_stack.emplace_back(CallInfo{this, func});
if ( f )
f->SetCall(this);
try
{
ret = func->Call(v, f);
}
catch ( ... )
{
call_stack.pop_back();
throw;
}
ret = func->Call(v, f);
if ( f )
f->SetCall(current_call);
// Don't Unref() the arguments, as Func::Call already did that.
delete v;
call_stack.pop_back();
}
else
delete_vals(v);