summaryrefslogtreecommitdiff
path: root/src/library/list.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-22 14:31:09 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-23 14:53:55 +0100
commite1f29d6cb9437a4afb2e4fc4ee10a5b8717ab9fa (patch)
tree1ce5f2bd858f6665d3867a2939d4b474c1b70377 /src/library/list.rs
parent2bf32c51bceb2f3a8b7ebea3d7c7d6d96757591b (diff)
Rework the core context
Diffstat (limited to 'src/library/list.rs')
-rw-r--r--src/library/list.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/library/list.rs b/src/library/list.rs
index 37dda843..b757e4b2 100644
--- a/src/library/list.rs
+++ b/src/library/list.rs
@@ -37,7 +37,7 @@ impl<const L: ListKind> ListNode<L> {
/// The space between the label and the body of each item.
pub const BODY_INDENT: Linear = Relative::new(0.5).into();
- fn construct(_: &mut Vm, args: &mut Args) -> TypResult<Template> {
+ fn construct(_: &mut Context, args: &mut Args) -> TypResult<Template> {
Ok(Template::show(Self {
start: args.named("start")?.unwrap_or(0),
wide: args.named("wide")?.unwrap_or(false),
@@ -51,10 +51,10 @@ impl<const L: ListKind> ListNode<L> {
}
impl<const L: ListKind> Show for ListNode<L> {
- fn show(&self, vm: &mut Vm, styles: StyleChain) -> TypResult<Template> {
+ fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult<Template> {
if let Some(template) = styles.show(
self,
- vm,
+ ctx,
self.items.iter().map(|item| Value::Template((*item.body).clone())),
)? {
return Ok(template);
@@ -72,7 +72,7 @@ impl<const L: ListKind> Show for ListNode<L> {
}
children.push(LayoutNode::default());
- children.push(label.resolve(vm, L, number)?.pack());
+ children.push(label.resolve(ctx, L, number)?.pack());
children.push(LayoutNode::default());
children.push((*item.body).clone().pack());
number += 1;
@@ -135,7 +135,7 @@ impl Label {
/// Resolve the value based on the level.
pub fn resolve(
&self,
- vm: &mut Vm,
+ ctx: &mut Context,
kind: ListKind,
number: usize,
) -> TypResult<Template> {
@@ -152,7 +152,7 @@ impl Label {
Self::Template(template) => template.clone(),
Self::Func(func, span) => {
let args = Args::from_values(*span, [Value::Int(number as i64)]);
- func.call(vm, args)?.cast().at(*span)?
+ func.call(ctx, args)?.cast().at(*span)?
}
})
}