Switch the get_loop_elements implementation to only return populated arrays when its an array-like object.

This commit is contained in:
Tom Alexander
2020-05-24 16:27:13 -04:00
parent 59ee4f508f
commit 966499db76
5 changed files with 14 additions and 50 deletions

View File

@@ -91,7 +91,7 @@ impl Loopable for ParametersContext {
// TODO: Would this even ever be called? Won't matter, but I'd
// like to know. Since it is injected 1 above the current
// context, we wouldn't be able to access it with `{.}`.
vec![self]
Vec::new()
}
}
@@ -158,16 +158,7 @@ impl Renderable for OwnedLiteral {
impl Loopable for OwnedLiteral {
fn get_loop_elements(&self) -> Vec<&dyn ContextElement> {
match self {
OwnedLiteral::LString(text) => {
if text.is_empty() {
Vec::new()
} else {
vec![self]
}
}
OwnedLiteral::LPositiveInteger(num) => vec![self],
}
Vec::new()
}
}