Lift out PathKind variant fields into structs

This commit is contained in:
Lukas Wirth 2022-06-20 13:29:13 +02:00
parent 5c69df93df
commit ce5859e387
9 changed files with 86 additions and 91 deletions

View file

@ -88,24 +88,13 @@ impl PathCompletionCtx {
#[derive(Debug, PartialEq, Eq)]
pub(super) enum PathKind {
Expr {
in_block_expr: bool,
in_loop_body: bool,
after_if_expr: bool,
/// Whether this expression is the direct condition of an if or while expression
in_condition: bool,
incomplete_let: bool,
ref_expr_parent: Option<ast::RefExpr>,
is_func_update: Option<ast::RecordExpr>,
self_param: Option<hir::SelfParam>,
innermost_ret_ty: Option<hir::Type>,
impl_: Option<ast::Impl>,
expr_ctx: ExprCtx,
},
Type {
location: TypeLocation,
},
Attr {
kind: AttrKind,
annotated_item_kind: Option<SyntaxKind>,
attr_ctx: AttrCtx,
},
Derive {
existing_derives: FxHashSet<hir::Macro>,
@ -122,6 +111,26 @@ pub(super) enum PathKind {
},
Use,
}
#[derive(Debug, PartialEq, Eq)]
pub(crate) struct AttrCtx {
pub(crate) kind: AttrKind,
pub(crate) annotated_item_kind: Option<SyntaxKind>,
}
#[derive(Debug, PartialEq, Eq)]
pub(crate) struct ExprCtx {
pub(crate) in_block_expr: bool,
pub(crate) in_loop_body: bool,
pub(crate) after_if_expr: bool,
/// Whether this expression is the direct condition of an if or while expression
pub(crate) in_condition: bool,
pub(crate) incomplete_let: bool,
pub(crate) ref_expr_parent: Option<ast::RefExpr>,
pub(crate) is_func_update: Option<ast::RecordExpr>,
pub(crate) self_param: Option<hir::SelfParam>,
pub(crate) innermost_ret_ty: Option<hir::Type>,
pub(crate) impl_: Option<ast::Impl>,
}
/// Original file ast nodes
#[derive(Clone, Debug, PartialEq, Eq)]