Switch Func::Call(val_list*) back to returning Val*

And renamed the method returning IntrusivePtr to operator().
This corrects the deprecation process for Func::Call(val_list*).
This commit is contained in:
Jon Siwek 2020-05-20 18:41:59 -07:00
parent 85a0ddd62d
commit 087a0f3636
15 changed files with 43 additions and 44 deletions

View file

@ -49,8 +49,8 @@ public:
const std::vector<Body>& GetBodies() const { return bodies; }
bool HasBodies() const { return bodies.size(); }
[[deprecated("Remove in v4.1. Use zeek::Args overload instead.")]]
virtual IntrusivePtr<Val> Call(val_list* args, Frame* parent = nullptr) const;
[[deprecated("Remove in v4.1. Use operator() instead.")]]
Val* Call(val_list* args, Frame* parent = nullptr) const;
/**
* Calls a Zeek function.
@ -58,18 +58,19 @@ public:
* @param parent the frame from which the function is being called.
* @return the return value of the function call.
*/
virtual IntrusivePtr<Val> Call(const zeek::Args& args, Frame* parent = nullptr) const = 0;
virtual IntrusivePtr<Val> operator()(const zeek::Args& args,
Frame* parent = nullptr) const = 0;
/**
* A version of Call() taking a variable number of individual arguments.
* A version of operator() taking a variable number of individual arguments.
*/
template <class... Args>
std::enable_if_t<
std::is_convertible_v<std::tuple_element_t<0, std::tuple<Args...>>,
IntrusivePtr<Val>>,
IntrusivePtr<Val>>
Call(Args&&... args) const
{ return Call(zeek::Args{std::forward<Args>(args)...}); }
operator()(Args&&... args) const
{ return operator()(zeek::Args{std::forward<Args>(args)...}); }
// Add a new event handler to an existing function (event).
virtual void AddBody(IntrusivePtr<Stmt> new_body, id_list* new_inits,
@ -128,7 +129,7 @@ public:
~BroFunc() override;
bool IsPure() const override;
IntrusivePtr<Val> Call(const zeek::Args& args, Frame* parent) const override;
IntrusivePtr<Val> operator()(const zeek::Args& args, Frame* parent) const override;
/**
* Adds adds a closure to the function. Closures are cloned and
@ -224,7 +225,7 @@ public:
~BuiltinFunc() override;
bool IsPure() const override;
IntrusivePtr<Val> Call(const zeek::Args& args, Frame* parent) const override;
IntrusivePtr<Val> operator()(const zeek::Args& args, Frame* parent) const override;
built_in_func TheFunc() const { return func; }
void Describe(ODesc* d) const override;