Change BIFs to return a wrapper object

That allows returning either Val* or IntrusivePtr<T>.  The former could
eventually be deprecated, but it's used extensively at the moment.
This commit is contained in:
Jon Siwek 2020-04-03 16:32:17 -07:00
parent 8843f69002
commit eb77411dbf
3 changed files with 29 additions and 3 deletions

View file

@ -633,7 +633,7 @@ IntrusivePtr<Val> BuiltinFunc::Call(const zeek::Args& args, Frame* parent) const
const CallExpr* call_expr = parent ? parent->GetCall() : nullptr;
call_stack.emplace_back(CallInfo{call_expr, this, args});
IntrusivePtr<Val> result{AdoptRef{}, func(parent, &args)};
auto result = std::move(func(parent, &args).rval);
call_stack.pop_back();
if ( result && g_trace_state.DoTrace() )
@ -890,3 +890,7 @@ function_ingredients::~function_ingredients()
delete inits;
}
BifReturnVal::BifReturnVal(Val* v) noexcept
: rval(AdoptRef{}, v)
{ }