feat: Desugar assist for let pat = expr?; -> let else

This commit is contained in:
Lukas Wirth 2025-05-28 11:12:28 +02:00
parent e72738de99
commit 751ca9ec0d
5 changed files with 336 additions and 171 deletions

View file

@ -585,6 +585,18 @@ impl SyntaxFactory {
ast
}
pub fn expr_underscore(&self) -> ast::UnderscoreExpr {
let ast::Expr::UnderscoreExpr(ast) = make::ext::expr_underscore().clone_for_update() else {
unreachable!()
};
if let Some(mut mapping) = self.mappings() {
SyntaxMappingBuilder::new(ast.syntax().clone()).finish(&mut mapping);
}
ast
}
pub fn expr_if(
&self,
condition: ast::Expr,