rustc_parse: Move AST -> TokenStream conversion logic to rustc_ast
This commit is contained in:
parent
acfd327fd4
commit
8e8fb4f49e
14 changed files with 124 additions and 284 deletions
|
@ -108,7 +108,7 @@ macro_rules! impl_has_span {
|
|||
};
|
||||
}
|
||||
|
||||
impl_has_span!(AssocItem, Expr, ForeignItem, Item, Stmt);
|
||||
impl_has_span!(AssocItem, Block, Expr, ForeignItem, Item, Pat, Path, Stmt, Ty, Visibility);
|
||||
|
||||
impl<T: AstDeref<Target: HasSpan>> HasSpan for T {
|
||||
fn span(&self) -> Span {
|
||||
|
@ -116,6 +116,12 @@ impl<T: AstDeref<Target: HasSpan>> HasSpan for T {
|
|||
}
|
||||
}
|
||||
|
||||
impl HasSpan for AttrItem {
|
||||
fn span(&self) -> Span {
|
||||
self.span()
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait for AST nodes having (or not having) collected tokens.
|
||||
pub trait HasTokens {
|
||||
fn tokens(&self) -> Option<&LazyTokenStream>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue