diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-01-04 18:40:39 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-01-04 18:40:39 +0100 |
commit | 263a8d293c67488065296737cdadee3d0e122bf5 (patch) | |
tree | 72e62a364a0bb158be82b77e77c0ef1a381479c5 /src/libexpr/json-to-value.cc | |
parent | cc08364315437bfd870363220373c48f64862e83 (diff) |
Remove non-method mk<X> functions
Diffstat (limited to 'src/libexpr/json-to-value.cc')
-rw-r--r-- | src/libexpr/json-to-value.cc | 27 |
1 files changed, 15 insertions, 12 deletions
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<json> { EvalState & state; std::unique_ptr<JSONState> rs; - template<typename T, typename... Args> 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) |