diff options
author | Lukas Wirth <[email protected]> | 2021-06-17 11:09:28 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-17 11:09:28 +0100 |
commit | cd5f4121e3bfb345f730bdce4106450e728f9721 (patch) | |
tree | fea98a0052a6c45743a86fddd01160936682ab8a /crates/syntax | |
parent | d6b8af44829521a9f925c4d87599efa3fef38edc (diff) |
Create modules in correct directory for nested modules in move_module assist
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/src/ast/node_ext.rs | 8 |
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 | ||
678 | impl 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 | |||
678 | impl ast::RangePat { | 686 | impl ast::RangePat { |
679 | pub fn start(&self) -> Option<ast::Pat> { | 687 | pub fn start(&self) -> Option<ast::Pat> { |
680 | self.syntax() | 688 | self.syntax() |