fix: await insertion with try_expr during extract_function

This commit is contained in:
vi_mi 2021-10-03 08:26:19 +00:00
parent 60c5449120
commit 61643513b6
2 changed files with 72 additions and 4 deletions

View file

@ -299,6 +299,9 @@ pub fn expr_return(expr: Option<ast::Expr>) -> ast::Expr {
pub fn expr_try(expr: ast::Expr) -> ast::Expr {
expr_from_text(&format!("{}?", expr))
}
pub fn expr_await(expr: ast::Expr) -> ast::Expr {
expr_from_text(&format!("{}.await", expr))
}
pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr {
expr_from_text(&format!("match {} {}", expr, match_arm_list))
}