aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/node_ext.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 2bd9ad867..b057e6624 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -675,6 +675,14 @@ impl ast::LifetimeParam {
675 } 675 }
676} 676}
677 677
678impl ast::Module {
679 /// Returns the parent ast::Module, this is different than the semantic parent in that this only
680 /// considers parent declarations in the AST
681 pub fn parent(&self) -> Option<ast::Module> {
682 self.syntax().ancestors().nth(2).and_then(ast::Module::cast)
683 }
684}
685
678impl ast::RangePat { 686impl ast::RangePat {
679 pub fn start(&self) -> Option<ast::Pat> { 687 pub fn start(&self) -> Option<ast::Pat> {
680 self.syntax() 688 self.syntax()