diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-12 13:39:33 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-12 13:56:23 +0200 |
| commit | eaa3cbaa9c2b1564a4b0db013672245a1893314a (patch) | |
| tree | 616a3d0f3686793caffcef72f230f8ba79b8f3ca /src/eval/ops.rs | |
| parent | 8207c31aec6336b773fbf4661fdb87625c8b584e (diff) | |
Array and dictionary indexing
Diffstat (limited to 'src/eval/ops.rs')
| -rw-r--r-- | src/eval/ops.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eval/ops.rs b/src/eval/ops.rs index 2bf1c189..f79b2bf6 100644 --- a/src/eval/ops.rs +++ b/src/eval/ops.rs @@ -150,12 +150,12 @@ pub fn mul(lhs: Value, rhs: Value) -> StrResult<Value> { (Fractional(a), Float(b)) => Fractional(a * b), (Int(a), Fractional(b)) => Fractional(a as f64 * b), - (Str(a), Int(b)) => Str(a.repeat(b.max(0) as usize)), - (Int(a), Str(b)) => Str(b.repeat(a.max(0) as usize)), - (Array(a), Int(b)) => Array(a.repeat(b.max(0) as usize)), - (Int(a), Array(b)) => Array(b.repeat(a.max(0) as usize)), - (Template(a), Int(b)) => Template(a.repeat(b.max(0) as usize)), - (Int(a), Template(b)) => Template(b.repeat(a.max(0) as usize)), + (Str(a), Int(b)) => Str(a.repeat(b)?), + (Int(a), Str(b)) => Str(b.repeat(a)?), + (Array(a), Int(b)) => Array(a.repeat(b)?), + (Int(a), Array(b)) => Array(b.repeat(a)?), + (Template(a), Int(b)) => Template(a.repeat(b)?), + (Int(a), Template(b)) => Template(b.repeat(a)?), (a, b) => mismatch!("cannot multiply {} with {}", a, b), }) |
