From 79c90b5641d2934864c587380e4f050ab63ac029 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 24 Dec 2019 23:45:14 +0100 Subject: Collect visibility of items during nameres --- crates/ra_syntax/src/ast/generated.rs | 3 +++ crates/ra_syntax/src/grammar.ron | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 9f9d6e63c..e64c83d33 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -1064,6 +1064,7 @@ impl AstNode for ExternCrateItem { } } impl ast::AttrsOwner for ExternCrateItem {} +impl ast::VisibilityOwner for ExternCrateItem {} impl ExternCrateItem { pub fn name_ref(&self) -> Option { AstChildren::new(&self.syntax).next() @@ -2006,6 +2007,7 @@ impl AstNode for ModuleItem { } } impl ast::AttrsOwner for ModuleItem {} +impl ast::VisibilityOwner for ModuleItem {} impl ModuleItem {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Name { @@ -3893,6 +3895,7 @@ impl AstNode for UseItem { } } impl ast::AttrsOwner for UseItem {} +impl ast::VisibilityOwner for UseItem {} impl UseItem { pub fn use_tree(&self) -> Option { AstChildren::new(&self.syntax).next() diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 08aafb610..e43a724f0 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -412,7 +412,7 @@ Grammar( "ModuleItem": ( enum: ["StructDef", "UnionDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock", "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ], - traits: ["AttrsOwner"], + traits: ["AttrsOwner", "VisibilityOwner"], ), "ImplItem": ( enum: ["FnDef", "TypeAliasDef", "ConstDef"], @@ -683,7 +683,7 @@ Grammar( ] ), "UseItem": ( - traits: ["AttrsOwner"], + traits: ["AttrsOwner", "VisibilityOwner"], options: [ "UseTree" ], ), "UseTree": ( @@ -696,7 +696,7 @@ Grammar( collections: [("use_trees", "UseTree")] ), "ExternCrateItem": ( - traits: ["AttrsOwner"], + traits: ["AttrsOwner", "VisibilityOwner"], options: ["NameRef", "Alias"], ), "ArgList": ( -- cgit v1.2.3