mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Add MethodCallExpr::get_or_create_generic_arg_list
Mirrors `PathSegment's` version, except that it always generates a turbofish
This commit is contained in:
parent
3b7c7f97e4
commit
02c7b8b9ba
2 changed files with 26 additions and 1 deletions
|
@ -14,7 +14,7 @@ use crate::{
|
|||
SyntaxNode, SyntaxToken,
|
||||
};
|
||||
|
||||
use super::HasName;
|
||||
use super::{HasArgList, HasName};
|
||||
|
||||
pub trait GenericParamsOwnerEdit: ast::HasGenericParams {
|
||||
fn get_or_create_generic_param_list(&self) -> ast::GenericParamList;
|
||||
|
@ -362,6 +362,24 @@ impl ast::PathSegment {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::MethodCallExpr {
|
||||
pub fn get_or_create_generic_arg_list(&self) -> ast::GenericArgList {
|
||||
if self.generic_arg_list().is_none() {
|
||||
let generic_arg_list = make::turbofish_generic_arg_list(empty()).clone_for_update();
|
||||
|
||||
if let Some(arg_list) = self.arg_list() {
|
||||
ted::insert_raw(
|
||||
ted::Position::before(arg_list.syntax()),
|
||||
generic_arg_list.syntax(),
|
||||
);
|
||||
} else {
|
||||
ted::append_child(self.syntax(), generic_arg_list.syntax());
|
||||
}
|
||||
}
|
||||
self.generic_arg_list().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Removable for ast::UseTree {
|
||||
fn remove(&self) {
|
||||
for dir in [Direction::Next, Direction::Prev] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue