aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r--crates/hir_def/src/item_tree.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs
index cad8a7479..797b905d1 100644
--- a/crates/hir_def/src/item_tree.rs
+++ b/crates/hir_def/src/item_tree.rs
@@ -132,6 +132,7 @@ impl ItemTree {
132 let ItemTreeData { 132 let ItemTreeData {
133 imports, 133 imports,
134 extern_crates, 134 extern_crates,
135 extern_blocks,
135 functions, 136 functions,
136 params, 137 params,
137 structs, 138 structs,
@@ -154,6 +155,7 @@ impl ItemTree {
154 155
155 imports.shrink_to_fit(); 156 imports.shrink_to_fit();
156 extern_crates.shrink_to_fit(); 157 extern_crates.shrink_to_fit();
158 extern_blocks.shrink_to_fit();
157 functions.shrink_to_fit(); 159 functions.shrink_to_fit();
158 params.shrink_to_fit(); 160 params.shrink_to_fit();
159 structs.shrink_to_fit(); 161 structs.shrink_to_fit();
@@ -239,6 +241,7 @@ static VIS_PUB_CRATE: RawVisibility = RawVisibility::Module(ModPath::from_kind(P
239struct ItemTreeData { 241struct ItemTreeData {
240 imports: Arena<Import>, 242 imports: Arena<Import>,
241 extern_crates: Arena<ExternCrate>, 243 extern_crates: Arena<ExternCrate>,
244 extern_blocks: Arena<ExternBlock>,
242 functions: Arena<Function>, 245 functions: Arena<Function>,
243 params: Arena<Param>, 246 params: Arena<Param>,
244 structs: Arena<Struct>, 247 structs: Arena<Struct>,
@@ -432,6 +435,7 @@ macro_rules! mod_items {
432mod_items! { 435mod_items! {
433 Import in imports -> ast::Use, 436 Import in imports -> ast::Use,
434 ExternCrate in extern_crates -> ast::ExternCrate, 437 ExternCrate in extern_crates -> ast::ExternCrate,
438 ExternBlock in extern_blocks -> ast::ExternBlock,
435 Function in functions -> ast::Fn, 439 Function in functions -> ast::Fn,
436 Struct in structs -> ast::Struct, 440 Struct in structs -> ast::Struct,
437 Union in unions -> ast::Union, 441 Union in unions -> ast::Union,
@@ -508,6 +512,13 @@ pub struct ExternCrate {
508} 512}
509 513
510#[derive(Debug, Clone, Eq, PartialEq)] 514#[derive(Debug, Clone, Eq, PartialEq)]
515pub struct ExternBlock {
516 pub abi: Option<Interned<str>>,
517 pub ast_id: FileAstId<ast::ExternBlock>,
518 pub children: Box<[ModItem]>,
519}
520
521#[derive(Debug, Clone, Eq, PartialEq)]
511pub struct Function { 522pub struct Function {
512 pub name: Name, 523 pub name: Name,
513 pub visibility: RawVisibilityId, 524 pub visibility: RawVisibilityId,
@@ -691,6 +702,7 @@ impl ModItem {
691 match self { 702 match self {
692 ModItem::Import(_) 703 ModItem::Import(_)
693 | ModItem::ExternCrate(_) 704 | ModItem::ExternCrate(_)
705 | ModItem::ExternBlock(_)
694 | ModItem::Struct(_) 706 | ModItem::Struct(_)
695 | ModItem::Union(_) 707 | ModItem::Union(_)
696 | ModItem::Enum(_) 708 | ModItem::Enum(_)
@@ -715,6 +727,7 @@ impl ModItem {
715 match self { 727 match self {
716 ModItem::Import(it) => tree[it.index].ast_id().upcast(), 728 ModItem::Import(it) => tree[it.index].ast_id().upcast(),
717 ModItem::ExternCrate(it) => tree[it.index].ast_id().upcast(), 729 ModItem::ExternCrate(it) => tree[it.index].ast_id().upcast(),
730 ModItem::ExternBlock(it) => tree[it.index].ast_id().upcast(),
718 ModItem::Function(it) => tree[it.index].ast_id().upcast(), 731 ModItem::Function(it) => tree[it.index].ast_id().upcast(),
719 ModItem::Struct(it) => tree[it.index].ast_id().upcast(), 732 ModItem::Struct(it) => tree[it.index].ast_id().upcast(),
720 ModItem::Union(it) => tree[it.index].ast_id().upcast(), 733 ModItem::Union(it) => tree[it.index].ast_id().upcast(),