Simplify creating TableLitElem

This commit is contained in:
Joscha 2022-11-22 16:35:16 +01:00
parent 45caafdc38
commit c191486864
5 changed files with 29 additions and 45 deletions

View file

@ -144,6 +144,18 @@ impl HasSpan for TableLitElem {
}
}
impl TableLitElem {
pub fn named(name: Ident, value: Box<Expr>, span: Span) -> Self {
Self::Named {
name,
s0: Space::empty(span),
s1: Space::empty(span),
value,
span,
}
}
}
/// `'{ a, foo: b }`
#[derive(Debug, Clone)]
pub struct TableLit(pub BoundedSeparated<TableLitElem>);