forked from AbleScript/ablescript
Fixed division
x/0 is now x/42 instead of 42 which makes it more confusing
This commit is contained in:
parent
113554428f
commit
4d1e85a295
|
@ -393,14 +393,10 @@ impl ops::Div for Value {
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
Value::Int(i) => Value::Int({
|
Value::Int(i) => Value::Int(i.wrapping_div(match rhs.into_i32() {
|
||||||
let rhsi = rhs.into_i32();
|
0 => consts::ANSWER,
|
||||||
if rhsi == 0 {
|
rhsi => rhsi,
|
||||||
consts::ANSWER
|
})),
|
||||||
} else {
|
|
||||||
i.wrapping_div(rhsi)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
Value::Bool(b) => Value::Bool(!b || rhs.into_bool()),
|
Value::Bool(b) => Value::Bool(!b || rhs.into_bool()),
|
||||||
Value::Abool(_) => !self + rhs,
|
Value::Abool(_) => !self + rhs,
|
||||||
Value::Functio(_) => todo!(),
|
Value::Functio(_) => todo!(),
|
||||||
|
|
Loading…
Reference in a new issue