Simplify creating TableConstrElem

This commit is contained in:
Joscha 2022-11-22 16:43:24 +01:00
parent c191486864
commit 58106c4c5a
7 changed files with 50 additions and 30 deletions

View file

@ -15,8 +15,10 @@ impl FuncDef {
} => {
let quote = BoundedSeparated::new(span)
.then(TableLitElem::named(Ident::new("quote", span), body, span))
.table_lit();
let quote = quote.lit().expr().boxed();
.table_lit()
.lit()
.expr()
.boxed();
let scope = Call::NoArg {
expr: Lit::Builtin(Builtin::Scope, span).expr().boxed(),
s0: Space::empty(span),
@ -24,12 +26,12 @@ impl FuncDef {
span,
};
let new = BoundedSeparated::new(span)
.then(TableConstrElem::Lit(TableLitElem::Positional(quote)))
.then(TableConstrElem::Lit(TableLitElem::named(
.then(TableConstrElem::positional(quote))
.then(TableConstrElem::named(
Ident::new("scope", span),
scope.expr().boxed(),
span,
)))
))
.table_constr()
.expr();
(new, true)