aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 11:10:25 +0100
committerGitHub <[email protected]>2021-06-17 11:10:25 +0100
commit3b58d8f785917b4212cd917fced6c3006210e4d3 (patch)
treeffe4d1ea9ff0d43956f27959f86dc7d878b72481 /crates/syntax/src
parent8ff46a368cbaad4f7ae28a2b19b7dde59ed75111 (diff)
parentcd5f4121e3bfb345f730bdce4106450e728f9721 (diff)
Merge #9308
9308: fix: Create modules in correct directory for nested modules in move_module assist r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/syntax/src')
-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()