@@ -5,36 +5,21 @@ namespace networkprotocoldsl::operation {
5
5
6
6
static Value _add (int32_t lhs, int32_t rhs) { return rhs + lhs; }
7
7
8
- static Value _add (int32_t lhs, auto rhs) {
9
- return value::RuntimeError::TypeError;
10
- }
11
-
12
- static Value _add (int32_t lhs, value::RuntimeError rhs) { return rhs; }
13
-
14
- static Value _add (int32_t lhs, value::ControlFlowInstruction rhs) {
15
- return rhs;
16
- }
17
-
18
- static Value _add (int32_t lhs, Value rhs) {
19
- return std::visit ([&lhs](auto rhs_v) -> Value { return _add (lhs, rhs_v); },
20
- rhs);
21
- }
22
-
23
- static Value _add (value::Callable lhs, auto rhs) {
24
- return value::RuntimeError::TypeError;
25
- }
8
+ static Value _add (auto &, auto &) { return value::RuntimeError::TypeError; }
26
9
27
10
static Value _add (value::RuntimeError lhs, auto rhs) { return lhs; }
28
11
29
12
static Value _add (value::ControlFlowInstruction lhs, auto rhs) { return lhs; }
30
13
31
- template <typename LHS, typename RHS> static Value _add (LHS lhs, RHS rhs) {
32
- return value::RuntimeError::TypeError;
14
+ static Value _add (int32_t lhs, value::RuntimeError rhs) { return rhs; }
15
+
16
+ static Value _add (int32_t lhs, value::ControlFlowInstruction rhs) {
17
+ return rhs;
33
18
}
34
19
35
20
Value Add::operator ()(Arguments a) const {
36
- return std::visit ([&a ](auto lhs) { return _add (lhs, std::get< 1 >(a) ); },
37
- std::get<0 >(a));
21
+ return std::visit ([](auto lhs, auto rhs ) { return _add (lhs, rhs ); },
22
+ std::get<0 >(a), std::get< 1 >(a) );
38
23
}
39
24
40
25
} // namespace networkprotocoldsl::operation
0 commit comments