Simplify creating Lit
This commit is contained in:
parent
fafc567447
commit
45caafdc38
8 changed files with 38 additions and 14 deletions
|
|
@ -53,6 +53,12 @@ impl HasSpan for NumLit {
|
|||
}
|
||||
}
|
||||
|
||||
impl NumLit {
|
||||
pub fn lit(self) -> Lit {
|
||||
Lit::Num(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum StringLitElem {
|
||||
/// Normal unescaped characters
|
||||
|
|
@ -100,6 +106,10 @@ impl StringLit {
|
|||
span: ident.span,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lit(self) -> Lit {
|
||||
Lit::String(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasSpan for StringLit {
|
||||
|
|
@ -144,6 +154,12 @@ impl HasSpan for TableLit {
|
|||
}
|
||||
}
|
||||
|
||||
impl TableLit {
|
||||
pub fn lit(self) -> Lit {
|
||||
Lit::Table(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Lit {
|
||||
/// `nil`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue