refactor(tvix/eval): vm::add_values(): be less verbose
Change-Id: Icf328649fd70bdf0fc3ba6cd7754ae29735f11f7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10035 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
243a4b5699
commit
91456c3520
1 changed files with 8 additions and 12 deletions
|
@ -1214,18 +1214,14 @@ async fn add_values(co: GenCo, a: Value, b: Value) -> Result<Value, ErrorKind> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(Value::String(s1), Value::String(s2)) => Value::String(s1.concat(&s2)),
|
(Value::String(s1), Value::String(s2)) => Value::String(s1.concat(&s2)),
|
||||||
(Value::String(s1), v) => Value::String(
|
(Value::String(s1), v) => generators::request_string_coerce(&co, v, CoercionKind::Weak)
|
||||||
match generators::request_string_coerce(&co, v, CoercionKind::Weak).await {
|
.await
|
||||||
Ok(s2) => s1.concat(&s2),
|
.map(|s2| Value::String(s1.concat(&s2)))
|
||||||
Err(c) => return Ok(Value::Catchable(c)),
|
.into(),
|
||||||
},
|
(v, Value::String(s2)) => generators::request_string_coerce(&co, v, CoercionKind::Weak)
|
||||||
),
|
.await
|
||||||
(v, Value::String(s2)) => Value::String(
|
.map(|s1| Value::String(s1.concat(&s2)))
|
||||||
match generators::request_string_coerce(&co, v, CoercionKind::Weak).await {
|
.into(),
|
||||||
Ok(s1) => s1.concat(&s2),
|
|
||||||
Err(c) => return Ok(Value::Catchable(c)),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
(a, b) => arithmetic_op!(&a, &b, +)?,
|
(a, b) => arithmetic_op!(&a, &b, +)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue