always return ExprKind::Err

This commit is contained in:
darklyspaced 2023-08-07 22:32:28 +08:00
parent 9ed5267e61
commit 13ac0234c6
No known key found for this signature in database

View File

@ -1717,12 +1717,7 @@ impl<'a> Parser<'a> {
self.recover_await_prefix(await_sp)?
};
let sp = self.error_on_incorrect_await(lo, hi, &expr, is_question);
let kind = match expr.kind {
// Avoid knock-down errors as we don't know whether to interpret this as `foo().await?`
// or `foo()?.await` (the very reason we went with postfix syntax 😅).
ExprKind::Try(_) => ExprKind::Err,
_ => ExprKind::Await(expr, await_sp),
};
let kind = ExprKind::Err;
let expr = self.mk_expr(lo.to(sp), kind);
self.maybe_recover_from_bad_qpath(expr)
}