Unnamed repository; edit this file 'description' to name the repository.
Add expr_const_value in syntax factory constructor
bit-aloo 8 days ago
parent 73ca1d4 · commit d3f2c4f
-rw-r--r--crates/syntax/src/ast/syntax_factory/constructors.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/syntax_factory/constructors.rs b/crates/syntax/src/ast/syntax_factory/constructors.rs
index f7876d94f8..1070af65e7 100644
--- a/crates/syntax/src/ast/syntax_factory/constructors.rs
+++ b/crates/syntax/src/ast/syntax_factory/constructors.rs
@@ -33,6 +33,10 @@ impl SyntaxFactory {
make::ext::expr_self().clone_for_update()
}
+ pub fn expr_const_value(&self, text: &str) -> ast::ConstArg {
+ make::expr_const_value(text).clone_for_update()
+ }
+
pub fn lifetime(&self, text: &str) -> ast::Lifetime {
make::lifetime(text).clone_for_update()
}
@@ -63,6 +67,14 @@ impl SyntaxFactory {
ast
}
+ pub fn ty_path_from_segments(
+ &self,
+ segments: impl IntoIterator<Item = ast::PathSegment>,
+ is_abs: bool,
+ ) -> ast::Type {
+ ast::Type::PathType(self.ty_path(self.path_from_segments(segments, is_abs)))
+ }
+
pub fn type_bound(&self, bound: ast::Type) -> ast::TypeBound {
make::type_bound(bound).clone_for_update()
}