From 263a8d293c67488065296737cdadee3d0e122bf5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 4 Jan 2022 18:40:39 +0100 Subject: Remove non-method mk functions --- src/libexpr/json-to-value.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/libexpr/json-to-value.cc') diff --git a/src/libexpr/json-to-value.cc b/src/libexpr/json-to-value.cc index 3825ca9a9..4dc41729a 100644 --- a/src/libexpr/json-to-value.cc +++ b/src/libexpr/json-to-value.cc @@ -76,39 +76,42 @@ class JSONSax : nlohmann::json_sax { EvalState & state; std::unique_ptr rs; - template inline bool handle_value(T f, Args... args) - { - f(rs->value(state), args...); - rs->add(); - return true; - } - public: JSONSax(EvalState & state, Value & v) : state(state), rs(new JSONState(&v)) {}; bool null() { - return handle_value(mkNull); + rs->value(state).mkNull(); + rs->add(); + return true; } bool boolean(bool val) { - return handle_value(mkBool, val); + rs->value(state).mkBool(val); + rs->add(); + return true; } bool number_integer(number_integer_t val) { - return handle_value(mkInt, val); + rs->value(state).mkInt(val); + rs->add(); + return true; } bool number_unsigned(number_unsigned_t val) { - return handle_value(mkInt, val); + rs->value(state).mkInt(val); + rs->add(); + return true; } bool number_float(number_float_t val, const string_t & s) { - return handle_value(mkFloat, val); + rs->value(state).mkFloat(val); + rs->add(); + return true; } bool string(string_t & val) -- cgit v1.2.3