summaryrefslogtreecommitdiff
path: root/src/syntax/ast/lit.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-04 19:06:20 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-04 19:06:20 +0200
commit0f7c70fd93db23ec866ae13aa2f146b7787afabf (patch)
tree7a67019fa77931e1722789cfd27997dd82a9b521 /src/syntax/ast/lit.rs
parent6672f8f7dfcb38bbda3ec92bdf95341c05e9a782 (diff)
Separate state and constraints 🧶
Diffstat (limited to 'src/syntax/ast/lit.rs')
-rw-r--r--src/syntax/ast/lit.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/syntax/ast/lit.rs b/src/syntax/ast/lit.rs
index 3b6441e7..acc3aa0b 100644
--- a/src/syntax/ast/lit.rs
+++ b/src/syntax/ast/lit.rs
@@ -5,7 +5,7 @@ use crate::eval::{DictKey, DictValue, SpannedEntry, Value};
use crate::layout::LayoutContext;
use crate::length::Length;
use crate::syntax::{Expr, Ident, SpanWith, Spanned, SynTree};
-use crate::{DynFuture, Feedback};
+use crate::DynFuture;
/// A literal.
#[derive(Debug, Clone, PartialEq)]
@@ -39,7 +39,7 @@ pub enum Lit {
impl Lit {
/// Evaluate the dictionary literal to a dictionary value.
- pub async fn eval(&self, ctx: &LayoutContext<'_>, f: &mut Feedback) -> Value {
+ pub async fn eval(&self, ctx: &mut LayoutContext) -> Value {
match *self {
Lit::Ident(ref i) => Value::Ident(i.clone()),
Lit::Bool(b) => Value::Bool(b),
@@ -49,7 +49,7 @@ impl Lit {
Lit::Percent(p) => Value::Relative(p / 100.0),
Lit::Color(c) => Value::Color(c),
Lit::Str(ref s) => Value::Str(s.clone()),
- Lit::Dict(ref d) => Value::Dict(d.eval(ctx, f).await),
+ Lit::Dict(ref d) => Value::Dict(d.eval(ctx).await),
Lit::Content(ref c) => Value::Tree(c.clone()),
}
}
@@ -66,16 +66,12 @@ impl LitDict {
}
/// Evaluate the dictionary literal to a dictionary value.
- pub fn eval<'a>(
- &'a self,
- ctx: &'a LayoutContext<'a>,
- f: &'a mut Feedback,
- ) -> DynFuture<'a, DictValue> {
+ pub fn eval<'a>(&'a self, ctx: &'a mut LayoutContext) -> DynFuture<'a, DictValue> {
Box::pin(async move {
let mut dict = DictValue::new();
for entry in &self.0 {
- let val = entry.expr.v.eval(ctx, f).await;
+ let val = entry.expr.v.eval(ctx).await;
let spanned = val.span_with(entry.expr.span);
if let Some(key) = &entry.key {
dict.insert(&key.v, SpannedEntry::new(key.span, spanned));