mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
feat: migrate introduce_named_generic assist to use SyntaxFactory
Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit is contained in:
parent
26bc01dae3
commit
1400aec433
2 changed files with 41 additions and 5 deletions
|
@ -14,6 +14,27 @@ impl SyntaxFactory {
|
|||
make::name(name).clone_for_update()
|
||||
}
|
||||
|
||||
pub fn ty(&self, text: &str) -> ast::Type {
|
||||
// FIXME: Is there anything to map here?
|
||||
make::ty(text).clone_for_update()
|
||||
}
|
||||
|
||||
pub fn type_param(
|
||||
&self,
|
||||
name: ast::Name,
|
||||
bounds: Option<ast::TypeBoundList>,
|
||||
) -> ast::TypeParam {
|
||||
let ast = make::type_param(name.clone(), bounds.clone()).clone_for_update();
|
||||
|
||||
if let Some(mut mapping) = self.mappings() {
|
||||
let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());
|
||||
builder.map_node(name.syntax().clone(), ast.name().unwrap().syntax().clone());
|
||||
builder.finish(&mut mapping);
|
||||
}
|
||||
|
||||
ast
|
||||
}
|
||||
|
||||
pub fn ident_pat(&self, ref_: bool, mut_: bool, name: ast::Name) -> ast::IdentPat {
|
||||
let ast = make::ident_pat(ref_, mut_, name.clone()).clone_for_update();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue