Tweak await span
This commit is contained in:
parent
12a2f24b15
commit
f0fc4f9acf
86 changed files with 480 additions and 401 deletions
|
@ -1646,7 +1646,7 @@ impl<'a> Parser<'a> {
|
|||
// 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),
|
||||
_ => ExprKind::Await(expr, await_sp),
|
||||
};
|
||||
let expr = self.mk_expr(lo.to(sp), kind);
|
||||
self.maybe_recover_from_bad_qpath(expr)
|
||||
|
|
|
@ -859,7 +859,7 @@ impl<'a> Parser<'a> {
|
|||
ExprKind::Field(_, _) => "a field access",
|
||||
ExprKind::MethodCall(_) => "a method call",
|
||||
ExprKind::Call(_, _) => "a function call",
|
||||
ExprKind::Await(_) => "`.await`",
|
||||
ExprKind::Await(_, _) => "`.await`",
|
||||
ExprKind::Err => return Ok(with_postfix),
|
||||
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
|
||||
}
|
||||
|
@ -3256,7 +3256,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
fn mk_await_expr(&mut self, self_arg: P<Expr>, lo: Span) -> P<Expr> {
|
||||
let span = lo.to(self.prev_token.span);
|
||||
let await_expr = self.mk_expr(span, ExprKind::Await(self_arg));
|
||||
let await_expr = self.mk_expr(span, ExprKind::Await(self_arg, self.prev_token.span));
|
||||
self.recover_from_await_method_call();
|
||||
await_expr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue