Error on out-of-range copy addressing instead of wrapping in the repeat family

This commit is contained in:
Dennis Kobert
2026-08-17 10:28:28 +00:00
parent bc29166d4c
commit 0c49026c9a
2 changed files with 16 additions and 7 deletions
+6 -2
View File
@@ -26,7 +26,9 @@ fn repeat_array<T>(
) -> Result<IList<(T, Attr<Transform>)>, Interrupt> {
let inner = content.inner_extent(ctx)?;
let (copy, rest) = ctx.split_innermost(inner);
let copy = copy % count.max(1) as u64;
if copy >= count as u64 {
return Err(GraphError::new("repeat addressed past its copy count").into());
}
let mut frame = IndexLink { index: 0, outer: None };
let (element, local) = content.eval(&ctx.push_level(&mut frame, copy, rest))?;
@@ -63,7 +65,9 @@ fn repeat_radial<T>(
) -> Result<IList<(T, Attr<Transform>)>, Interrupt> {
let inner = content.inner_extent(ctx)?;
let (copy, rest) = ctx.split_innermost(inner);
let copy = copy % count.max(1) as u64;
if copy >= count as u64 {
return Err(GraphError::new("repeat addressed past its copy count").into());
}
let mut frame = IndexLink { index: 0, outer: None };
let (element, local) = content.eval(&ctx.push_level(&mut frame, copy, rest))?;