microcad_lang/eval/
body.rs1use crate::{eval::*, model::*};
5
6impl Eval<Value> for Body {
8 fn eval(&self, context: &mut EvalContext) -> EvalResult<Value> {
9 context.scope(StackFrame::Body(SymbolMap::default()), |context| {
10 self.statements.eval(context)
11 })
12 }
13}
14
15impl Eval<Option<Model>> for Body {
17 fn eval(&self, context: &mut EvalContext) -> EvalResult<Option<Model>> {
18 context
19 .scope(StackFrame::Body(SymbolMap::default()), |context| {
20 Ok(ModelBuilder::new(Element::Group, self.src_ref())
21 .add_children(self.statements.eval(context)?)?
22 .attributes(self.statements.eval(context)?)
23 .build())
24 })
25 .map(Some)
26 }
27}