diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-14 20:43:03 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-14 20:43:03 +0200 |
| commit | c8f6b5bd5c55845562571c196a0b2c1a7ca20f71 (patch) | |
| tree | 0e5066064f1bf81f847cb1cfe23578e2f42fe1e8 /src/library/boxed.rs | |
| parent | 650c712eabc6f665a0a0cc2a47fb5b90cf715d87 (diff) | |
Desugar body into last argument 🍩
Diffstat (limited to 'src/library/boxed.rs')
| -rw-r--r-- | src/library/boxed.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/boxed.rs b/src/library/boxed.rs index 5191480f..3ca3ae44 100644 --- a/src/library/boxed.rs +++ b/src/library/boxed.rs @@ -8,9 +8,9 @@ use super::*; /// - `height`: The height of the box (length of relative to parent's height). pub fn boxed(call: FuncCall, _: &ParseState) -> Pass<SyntaxNode> { let mut f = Feedback::new(); - let mut args = call.header.args; + let mut args = call.args; let node = BoxNode { - body: call.body.map(|s| s.v).unwrap_or(SyntaxTree::new()), + content: args.pos.get::<SyntaxTree>().unwrap_or(SyntaxTree::new()), width: args.key.get::<ScaleLength>("width", &mut f), height: args.key.get::<ScaleLength>("height", &mut f), }; @@ -20,7 +20,7 @@ pub fn boxed(call: FuncCall, _: &ParseState) -> Pass<SyntaxNode> { #[derive(Debug, Clone, PartialEq)] struct BoxNode { - body: SyntaxTree, + content: SyntaxTree, width: Option<ScaleLength>, height: Option<ScaleLength>, } @@ -45,7 +45,7 @@ impl Layout for BoxNode { ctx.spaces[0].expansion.vertical = true; }); - layout(&self.body, ctx).await.map(|out| { + layout(&self.content, ctx).await.map(|out| { let layout = out.into_iter().next().unwrap(); vec![Add(layout)] }) |
