fix: rewrite code_action generate_delegate_trait

This commit is contained in:
roife 2023-12-13 11:22:42 +08:00
parent 19387d3077
commit 59aa791fe6
8 changed files with 983 additions and 158 deletions

View file

@ -82,6 +82,34 @@ impl<'a> PathTransform<'a> {
}
}
pub fn impl_transformation(
target_scope: &'a SemanticsScope<'a>,
source_scope: &'a SemanticsScope<'a>,
impl_: hir::Impl,
generic_arg_list: ast::GenericArgList,
) -> PathTransform<'a> {
PathTransform {
source_scope,
target_scope,
generic_def: Some(impl_.into()),
substs: get_type_args_from_arg_list(generic_arg_list).unwrap_or_default(),
}
}
pub fn adt_transformation(
target_scope: &'a SemanticsScope<'a>,
source_scope: &'a SemanticsScope<'a>,
adt: hir::Adt,
generic_arg_list: ast::GenericArgList,
) -> PathTransform<'a> {
PathTransform {
source_scope,
target_scope,
generic_def: Some(adt.into()),
substs: get_type_args_from_arg_list(generic_arg_list).unwrap_or_default(),
}
}
pub fn generic_transformation(
target_scope: &'a SemanticsScope<'a>,
source_scope: &'a SemanticsScope<'a>,