Split out ExpressionStore from Body

This commit is contained in:
Lukas Wirth 2025-01-25 15:52:52 +01:00
parent db6d23c0e5
commit 55d1d5dd8b
28 changed files with 530 additions and 444 deletions

View file

@ -3,7 +3,7 @@
use base_db::{ra_salsa::Cycle, CrateId};
use chalk_ir::{cast::Cast, BoundVar, DebruijnIndex};
use hir_def::{
body::{Body, HygieneId},
expr_store::{Body, HygieneId},
hir::{Expr, ExprId},
path::Path,
resolver::{Resolver, ValueNs},

View file

@ -36,7 +36,7 @@ use crate::{
};
pub(crate) use hir_def::{
body::Body,
expr_store::Body,
hir::{Expr, ExprId, MatchArm, Pat, PatId, Statement},
LocalFieldId, VariantId,
};

View file

@ -11,7 +11,8 @@ pub(crate) mod pat_analysis;
use chalk_ir::Mutability;
use hir_def::{
body::Body, data::adt::VariantData, hir::PatId, AdtId, EnumVariantId, LocalFieldId, VariantId,
data::adt::VariantData, expr_store::Body, hir::PatId, AdtId, EnumVariantId, LocalFieldId,
VariantId,
};
use hir_expand::name::Name;
use span::Edition;

View file

@ -5,7 +5,7 @@ use std::mem;
use either::Either;
use hir_def::{
body::Body,
expr_store::Body,
hir::{Expr, ExprId, ExprOrPatId, Pat, PatId, Statement, UnaryOp},
path::Path,
resolver::{HasResolver, ResolveValueResult, Resolver, ValueNs},

View file

@ -34,9 +34,9 @@ use chalk_ir::{
};
use either::Either;
use hir_def::{
body::{Body, HygieneId},
builtin_type::{BuiltinInt, BuiltinType, BuiltinUint},
data::{ConstData, StaticData},
expr_store::{Body, HygieneId},
hir::{BindingAnnotation, BindingId, ExprId, ExprOrPatId, LabelId, PatId},
lang_item::{LangItem, LangItemTarget},
layout::Integer,

View file

@ -5,7 +5,7 @@
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use hir_def::body::HygieneId;
use hir_def::expr_store::HygieneId;
use hir_def::hir::ExprOrPatId;
use hir_def::path::{Path, PathSegment, PathSegments};
use hir_def::resolver::{ResolveValueResult, Resolver, TypeNs};

View file

@ -3,7 +3,7 @@
use std::iter::repeat_with;
use hir_def::{
body::Body,
expr_store::Body,
hir::{Binding, BindingAnnotation, BindingId, Expr, ExprId, Literal, Pat, PatId},
path::Path,
};
@ -528,7 +528,7 @@ impl InferenceContext<'_> {
self.infer_expr(expr, &Expectation::has_type(expected.clone()), ExprIsRead::Yes)
}
fn is_non_ref_pat(&mut self, body: &hir_def::body::Body, pat: PatId) -> bool {
fn is_non_ref_pat(&mut self, body: &hir_def::expr_store::Body, pat: PatId) -> bool {
match &body[pat] {
Pat::Tuple { .. }
| Pat::TupleStruct { .. }

View file

@ -23,10 +23,10 @@ use chalk_ir::{
use either::Either;
use hir_def::{
body::HygieneId,
builtin_type::BuiltinType,
data::{adt::StructKind, TraitFlags},
expander::Expander,
expr_store::HygieneId,
generics::{
GenericParamDataRef, TypeOrConstParamData, TypeParamProvenance, WherePredicate,
WherePredicateTypeTarget,

View file

@ -16,7 +16,7 @@ use base_db::CrateId;
use chalk_ir::Mutability;
use either::Either;
use hir_def::{
body::Body,
expr_store::Body,
hir::{BindingAnnotation, BindingId, Expr, ExprId, Ordering, PatId},
DefWithBodyId, FieldId, StaticId, TupleFieldId, UnionId, VariantId,
};

View file

@ -6,9 +6,9 @@ use base_db::CrateId;
use chalk_ir::{cast::Cast, Mutability};
use either::Either;
use hir_def::{
body::HygieneId,
builtin_type::BuiltinType,
data::adt::{StructFlags, VariantData},
expr_store::HygieneId,
lang_item::LangItem,
layout::{TagEncoding, Variants},
resolver::{HasResolver, TypeNs, ValueNs},

View file

@ -5,8 +5,8 @@ use std::{fmt::Write, iter, mem};
use base_db::ra_salsa::Cycle;
use chalk_ir::{BoundVar, ConstData, DebruijnIndex, TyKind};
use hir_def::{
body::{Body, HygieneId},
data::adt::{StructKind, VariantData},
expr_store::{Body, HygieneId},
hir::{
ArithOp, Array, BinaryOp, BindingAnnotation, BindingId, ExprId, LabelId, Literal,
LiteralOrConst, MatchArm, Pat, PatId, RecordFieldPat, RecordLitField,

View file

@ -6,7 +6,7 @@ use std::{
};
use either::Either;
use hir_def::{body::Body, hir::BindingId};
use hir_def::{expr_store::Body, hir::BindingId};
use hir_expand::{name::Name, Lookup};
use la_arena::ArenaMap;
use span::Edition;

View file

@ -18,8 +18,8 @@ use std::sync::LazyLock;
use base_db::SourceDatabaseFileInputExt as _;
use expect_test::Expect;
use hir_def::{
body::{Body, BodySourceMap},
db::DefDatabase,
expr_store::{Body, BodySourceMap},
hir::{ExprId, Pat, PatId},
item_scope::ItemScope,
nameres::DefMap,