2013-08-15 22:28:54 +02:00
|
|
|
//! This module is used to store stuff from Rust's AST in a more convenient
|
|
|
|
//! manner (and with prettier names) before cleaning.
|
2020-12-02 05:18:46 +01:00
|
|
|
use rustc_span::{self, Span, Symbol};
|
2016-06-22 00:08:13 +02:00
|
|
|
|
2020-01-05 02:37:57 +01:00
|
|
|
use rustc_hir as hir;
|
2014-05-16 19:15:33 +02:00
|
|
|
|
2020-11-14 23:59:58 +01:00
|
|
|
crate struct Module<'hir> {
|
|
|
|
crate name: Option<Symbol>,
|
|
|
|
crate where_outer: Span,
|
|
|
|
crate where_inner: Span,
|
|
|
|
crate mods: Vec<Module<'hir>>,
|
|
|
|
crate id: hir::HirId,
|
2020-11-21 16:10:03 +01:00
|
|
|
// (item, renamed)
|
2020-12-02 05:18:46 +01:00
|
|
|
crate items: Vec<(&'hir hir::Item<'hir>, Option<Symbol>)>,
|
|
|
|
crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
|
|
|
|
crate macros: Vec<(&'hir hir::MacroDef<'hir>, Option<Symbol>)>,
|
2020-11-14 23:59:58 +01:00
|
|
|
crate is_crate: bool,
|
2013-08-15 22:28:54 +02:00
|
|
|
}
|
|
|
|
|
2019-06-12 10:43:15 +02:00
|
|
|
impl Module<'hir> {
|
2020-12-23 21:05:06 +01:00
|
|
|
crate fn new(name: Option<Symbol>) -> Module<'hir> {
|
2013-08-15 22:28:54 +02:00
|
|
|
Module {
|
2020-03-06 19:28:44 +01:00
|
|
|
name,
|
2019-07-24 22:28:51 +02:00
|
|
|
id: hir::CRATE_HIR_ID,
|
2019-12-31 18:15:40 +01:00
|
|
|
where_outer: rustc_span::DUMMY_SP,
|
|
|
|
where_inner: rustc_span::DUMMY_SP,
|
2019-12-22 23:42:04 +01:00
|
|
|
mods: Vec::new(),
|
2020-11-21 05:50:13 +01:00
|
|
|
items: Vec::new(),
|
2019-12-22 23:42:04 +01:00
|
|
|
foreigns: Vec::new(),
|
|
|
|
macros: Vec::new(),
|
|
|
|
is_crate: false,
|
2013-08-15 22:28:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|