fix #104867, Properly handle postfix inc/dec in standalone and subexpr scenarios
This commit is contained in:
parent
1dda298ad3
commit
7c11a53f9c
7 changed files with 188 additions and 64 deletions
|
@ -292,7 +292,15 @@ impl<'a> Parser<'a> {
|
|||
let op_span = self.prev_token.span.to(self.token.span);
|
||||
// Eat the second `+`
|
||||
self.bump();
|
||||
lhs = self.recover_from_postfix_increment(lhs, op_span)?;
|
||||
let prev_is_semi = {
|
||||
if let Ok(prev_code) = self.sess.source_map().span_to_prev_source(lhs.span) &&
|
||||
prev_code.trim_end().ends_with(";") {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
};
|
||||
lhs = self.recover_from_postfix_increment(lhs, op_span, prev_is_semi)?;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue