Create modules in correct directory for nested modules in move_module assist

This commit is contained in:
Lukas Wirth 2021-06-17 12:09:28 +02:00
parent d6b8af4482
commit cd5f4121e3
2 changed files with 60 additions and 13 deletions

View file

@ -675,6 +675,14 @@ impl ast::LifetimeParam {
}
}
impl ast::Module {
/// Returns the parent ast::Module, this is different than the semantic parent in that this only
/// considers parent declarations in the AST
pub fn parent(&self) -> Option<ast::Module> {
self.syntax().ancestors().nth(2).and_then(ast::Module::cast)
}
}
impl ast::RangePat {
pub fn start(&self) -> Option<ast::Pat> {
self.syntax()