Merge #623
623: WIP: module id is not def id r=matklad a=matklad This achieves two things: * makes module_tree & item_map per crate, not per source_root * begins the refactoring to remove universal `DefId` in favor of having separate ids for each kind of `Def`. Currently, only modules get a differnt ID though. Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
@@ -430,6 +430,13 @@ impl StructDef {
|
||||
}
|
||||
|
||||
impl EnumVariant {
|
||||
pub fn parent_enum(&self) -> &EnumDef {
|
||||
self.syntax()
|
||||
.parent()
|
||||
.and_then(|it| it.parent())
|
||||
.and_then(EnumDef::cast)
|
||||
.expect("EnumVariants are always nested in Enums")
|
||||
}
|
||||
pub fn flavor(&self) -> StructFlavor {
|
||||
StructFlavor::from_node(self)
|
||||
}
|
||||
|
||||
@@ -3229,6 +3229,7 @@ impl ast::VisibilityOwner for TraitDef {}
|
||||
impl ast::NameOwner for TraitDef {}
|
||||
impl ast::AttrsOwner for TraitDef {}
|
||||
impl ast::DocCommentsOwner for TraitDef {}
|
||||
impl ast::TypeParamsOwner for TraitDef {}
|
||||
impl TraitDef {}
|
||||
|
||||
// TrueKw
|
||||
|
||||
@@ -280,7 +280,7 @@ Grammar(
|
||||
], options: [["variant_list", "EnumVariantList"]] ),
|
||||
"EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
|
||||
"EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ),
|
||||
"TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ),
|
||||
"TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ),
|
||||
"Module": (
|
||||
traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
|
||||
options: [ "ItemList" ]
|
||||
@@ -489,7 +489,7 @@ Grammar(
|
||||
),
|
||||
|
||||
"RefPat": ( options: [ "Pat" ]),
|
||||
"BindPat": (
|
||||
"BindPat": (
|
||||
options: [ "Pat" ],
|
||||
traits: ["NameOwner"]
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user