Store patterns desugared from destructuring assignments in source map

And few more fixups.

I was worried this will lead to more memory usage since `ExprOrPatId` is double the size of `ExprId`, but this does not regress `analysis-stats .`. If this turns out to be a problem, we can easily use the high bit to encode this information.
This commit is contained in:
Chayim Refael Friedman 2024-10-06 22:52:56 +03:00
parent 61f162a43d
commit 2d4d6b678f
16 changed files with 280 additions and 174 deletions

View file

@ -11,7 +11,7 @@ use std::{
use either::Either;
use hir_def::{
hir::Expr,
hir::{Expr, ExprOrPatId},
lower::LowerCtx,
nameres::{MacroSubNs, ModuleOrigin},
path::ModPath,
@ -1755,7 +1755,9 @@ impl<'db> SemanticsImpl<'db> {
}
if let Some(parent) = ast::Expr::cast(parent.clone()) {
if let Some(expr_id) = source_map.node_expr(InFile { file_id, value: &parent }) {
if let Some(ExprOrPatId::ExprId(expr_id)) =
source_map.node_expr(InFile { file_id, value: &parent })
{
if let Expr::Unsafe { .. } = body[expr_id] {
break true;
}