1
Fork 0

ast: Add span to Extern

This commit is contained in:
Nixon Enraght-Moony 2022-07-02 18:25:55 +01:00
parent 5018181c79
commit 18ca2946e0
10 changed files with 32 additions and 19 deletions

View file

@ -2667,13 +2667,16 @@ impl Item {
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
pub enum Extern {
None,
Implicit,
Explicit(StrLit),
Implicit(Span),
Explicit(StrLit, Span),
}
impl Extern {
pub fn from_abi(abi: Option<StrLit>) -> Extern {
abi.map_or(Extern::Implicit, Extern::Explicit)
pub fn from_abi(abi: Option<StrLit>, span: Span) -> Extern {
match abi {
Some(name) => Extern::Explicit(name, span),
None => Extern::Implicit(span),
}
}
}