Skip to content

Commit 5ce99f1

Browse files
committed
add use tree list method to syntaxFactory constructor
1 parent bb0e103 commit 5ce99f1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

crates/syntax/src/ast/syntax_factory/constructors.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ impl SyntaxFactory {
7171
make::type_bound_text(bound).clone_for_update()
7272
}
7373

74+
pub fn use_tree_list(
75+
&self,
76+
use_trees: impl IntoIterator<Item = ast::UseTree>,
77+
) -> ast::UseTreeList {
78+
let (use_trees, input) = iterator_input(use_trees);
79+
let ast = make::use_tree_list(use_trees).clone_for_update();
80+
81+
if let Some(mut mapping) = self.mappings() {
82+
let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());
83+
builder.map_children(input, ast.use_trees().map(|b| b.syntax().clone()));
84+
builder.finish(&mut mapping);
85+
}
86+
87+
ast
88+
}
89+
7490
pub fn type_bound_list(
7591
&self,
7692
bounds: impl IntoIterator<Item = ast::TypeBound>,

0 commit comments

Comments
 (0)