diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-22 14:31:09 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-23 14:53:55 +0100 |
| commit | e1f29d6cb9437a4afb2e4fc4ee10a5b8717ab9fa (patch) | |
| tree | 1ce5f2bd858f6665d3867a2939d4b474c1b70377 /src/eval/styles.rs | |
| parent | 2bf32c51bceb2f3a8b7ebea3d7c7d6d96757591b (diff) | |
Rework the core context
Diffstat (limited to 'src/eval/styles.rs')
| -rw-r--r-- | src/eval/styles.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/eval/styles.rs b/src/eval/styles.rs index 346eb784..bd1f808f 100644 --- a/src/eval/styles.rs +++ b/src/eval/styles.rs @@ -3,9 +3,10 @@ use std::fmt::{self, Debug, Formatter}; use std::hash::{Hash, Hasher}; use std::sync::Arc; -use super::{Args, Func, Span, Template, Value, Vm}; +use super::{Args, Func, Span, Template, Value}; use crate::diag::{At, TypResult}; use crate::library::{PageNode, ParNode}; +use crate::Context; /// A map of style properties. #[derive(Default, Clone, PartialEq, Hash)] @@ -341,11 +342,6 @@ impl<'a> StyleChain<'a> { *self = self.outer.copied().unwrap_or_default(); } - /// Return the span of a recipe for the given node. - pub(crate) fn recipe_span(self, node: TypeId) -> Option<Span> { - self.recipes(node).next().map(|recipe| recipe.span) - } - /// Return the chain, but without the last link if that one contains only /// scoped styles. This is a hack. pub(crate) fn unscoped(mut self, node: TypeId) -> Self { @@ -415,12 +411,12 @@ impl<'a> StyleChain<'a> { pub fn show( self, node: &dyn Any, - vm: &mut Vm, + ctx: &mut Context, values: impl IntoIterator<Item = Value>, ) -> TypResult<Option<Template>> { Ok(if let Some(recipe) = self.recipes(node.type_id()).next() { let args = Args::from_values(recipe.span, values); - Some(recipe.func.call(vm, args)?.cast().at(recipe.span)?) + Some(recipe.func.call(ctx, args)?.cast().at(recipe.span)?) } else { None }) |
