mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Auto merge of #14128 - Veykril:parser, r=Veykril
internal: Improve parser recovery for delimited lists Closes https://github.com/rust-lang/rust-analyzer/issues/11188, https://github.com/rust-lang/rust-analyzer/issues/10410, https://github.com/rust-lang/rust-analyzer/issues/10173 Should probably be merged after the stable release as this might get the parser stuck if I missed something
This commit is contained in:
commit
44568007d1
33 changed files with 817 additions and 367 deletions
|
@ -668,8 +668,15 @@ fn classify_name_ref(
|
|||
};
|
||||
let after_if_expr = |node: SyntaxNode| {
|
||||
let prev_expr = (|| {
|
||||
let node = match node.parent().and_then(ast::ExprStmt::cast) {
|
||||
Some(stmt) => stmt.syntax().clone(),
|
||||
None => node,
|
||||
};
|
||||
let prev_sibling = non_trivia_sibling(node.into(), Direction::Prev)?.into_node()?;
|
||||
ast::ExprStmt::cast(prev_sibling)?.expr()
|
||||
|
||||
ast::ExprStmt::cast(prev_sibling.clone())
|
||||
.and_then(|it| it.expr())
|
||||
.or_else(|| ast::Expr::cast(prev_sibling))
|
||||
})();
|
||||
matches!(prev_expr, Some(ast::Expr::IfExpr(_)))
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue