Add visibility to span for macros 2.0
This commit is contained in:
parent
a209539060
commit
ed63e0be95
1 changed files with 5 additions and 5 deletions
|
@ -3789,9 +3789,9 @@ impl<'a> Parser<'a> {
|
||||||
is_defaultness
|
is_defaultness
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eat_macro_def(&mut self, attrs: &[Attribute], vis: &Visibility)
|
fn eat_macro_def(&mut self, attrs: &[Attribute], vis: &Visibility, lo: Span)
|
||||||
-> PResult<'a, Option<P<Item>>> {
|
-> PResult<'a, Option<P<Item>>> {
|
||||||
let lo = self.span;
|
let token_lo = self.span;
|
||||||
let (ident, def) = match self.token {
|
let (ident, def) = match self.token {
|
||||||
token::Ident(ident) if ident.name == keywords::Macro.name() => {
|
token::Ident(ident) if ident.name == keywords::Macro.name() => {
|
||||||
self.bump();
|
self.bump();
|
||||||
|
@ -3811,7 +3811,7 @@ impl<'a> Parser<'a> {
|
||||||
};
|
};
|
||||||
TokenStream::concat(vec![
|
TokenStream::concat(vec![
|
||||||
args.into(),
|
args.into(),
|
||||||
TokenTree::Token(lo.to(self.prev_span), token::FatArrow).into(),
|
TokenTree::Token(token_lo.to(self.prev_span), token::FatArrow).into(),
|
||||||
body.into(),
|
body.into(),
|
||||||
])
|
])
|
||||||
} else {
|
} else {
|
||||||
|
@ -3861,7 +3861,7 @@ impl<'a> Parser<'a> {
|
||||||
node: StmtKind::Local(self.parse_local(attrs.into())?),
|
node: StmtKind::Local(self.parse_local(attrs.into())?),
|
||||||
span: lo.to(self.prev_span),
|
span: lo.to(self.prev_span),
|
||||||
}
|
}
|
||||||
} else if let Some(macro_def) = self.eat_macro_def(&attrs, &Visibility::Inherited)? {
|
} else if let Some(macro_def) = self.eat_macro_def(&attrs, &Visibility::Inherited, lo)? {
|
||||||
Stmt {
|
Stmt {
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
node: StmtKind::Item(macro_def),
|
node: StmtKind::Item(macro_def),
|
||||||
|
@ -6011,7 +6011,7 @@ impl<'a> Parser<'a> {
|
||||||
maybe_append(attrs, extra_attrs));
|
maybe_append(attrs, extra_attrs));
|
||||||
return Ok(Some(item));
|
return Ok(Some(item));
|
||||||
}
|
}
|
||||||
if let Some(macro_def) = self.eat_macro_def(&attrs, &visibility)? {
|
if let Some(macro_def) = self.eat_macro_def(&attrs, &visibility, lo)? {
|
||||||
return Ok(Some(macro_def));
|
return Ok(Some(macro_def));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue