mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Finish extern crates grammar
This commit is contained in:
parent
570fdf26c9
commit
d032f872b6
8 changed files with 75 additions and 75 deletions
|
@ -671,7 +671,7 @@ impl ExprCollector<'_> {
|
|||
ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks
|
||||
ast::Item::ImplDef(_)
|
||||
| ast::Item::UseItem(_)
|
||||
| ast::Item::ExternCrateItem(_)
|
||||
| ast::Item::ExternCrate(_)
|
||||
| ast::Item::Module(_)
|
||||
| ast::Item::MacroCall(_) => return None,
|
||||
};
|
||||
|
|
|
@ -412,7 +412,7 @@ macro_rules! mod_items {
|
|||
|
||||
mod_items! {
|
||||
Import in imports -> ast::UseItem,
|
||||
ExternCrate in extern_crates -> ast::ExternCrateItem,
|
||||
ExternCrate in extern_crates -> ast::ExternCrate,
|
||||
Function in functions -> ast::FnDef,
|
||||
Struct in structs -> ast::StructDef,
|
||||
Union in unions -> ast::UnionDef,
|
||||
|
@ -492,7 +492,7 @@ pub struct ExternCrate {
|
|||
pub visibility: RawVisibilityId,
|
||||
/// Whether this is a `#[macro_use] extern crate ...`.
|
||||
pub is_macro_use: bool,
|
||||
pub ast_id: FileAstId<ast::ExternCrateItem>,
|
||||
pub ast_id: FileAstId<ast::ExternCrate>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
|
|
|
@ -95,7 +95,7 @@ impl Ctx {
|
|||
ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {}
|
||||
|
||||
// These don't have inner items.
|
||||
ast::Item::Module(_) | ast::Item::ExternCrateItem(_) | ast::Item::UseItem(_) => {}
|
||||
ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::UseItem(_) => {}
|
||||
};
|
||||
|
||||
let attrs = Attrs::new(item, &self.hygiene);
|
||||
|
@ -113,7 +113,7 @@ impl Ctx {
|
|||
ast::Item::UseItem(ast) => Some(ModItems(
|
||||
self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(),
|
||||
)),
|
||||
ast::Item::ExternCrateItem(ast) => self.lower_extern_crate(ast).map(Into::into),
|
||||
ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into),
|
||||
ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
|
||||
ast::Item::ExternBlock(ast) => {
|
||||
Some(ModItems(self.lower_extern_block(ast).into_iter().collect::<SmallVec<_>>()))
|
||||
|
@ -498,7 +498,7 @@ impl Ctx {
|
|||
|
||||
fn lower_extern_crate(
|
||||
&mut self,
|
||||
extern_crate: &ast::ExternCrateItem,
|
||||
extern_crate: &ast::ExternCrate,
|
||||
) -> Option<FileItemTreeId<ExternCrate>> {
|
||||
let path = ModPath::from_name_ref(&extern_crate.name_ref()?);
|
||||
let alias = extern_crate.rename().map(|a| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue