Skip to content

Commit b0d81d9

Browse files
bors[bot]matklad
andauthored
Merge #7017
7017: Document `make` module design r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents ee06096 + f00f75a commit b0d81d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/syntax/src/ast/make.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
//! Note that all functions here intended to be stupid constructors, which just
55
//! assemble a finish node from immediate children. If you want to do something
66
//! smarter than that, it probably doesn't belong in this module.
7+
//!
8+
//! Keep in mind that `from_text` functions should be kept private. The public
9+
//! API should require to assemble every node piecewise. The trick of
10+
//! `parse(format!())` we use internally is an implementation detail -- long
11+
//! term, it will be replaced with direct tree manipulation.
712
use itertools::Itertools;
813
use stdx::format_to;
914

@@ -16,7 +21,8 @@ pub fn name(text: &str) -> ast::Name {
1621
pub fn name_ref(text: &str) -> ast::NameRef {
1722
ast_from_text(&format!("fn f() {{ {}; }}", text))
1823
}
19-
24+
// FIXME: replace stringly-typed constructor with a family of typed ctors, a-la
25+
// `expr_xxx`.
2026
pub fn ty(text: &str) -> ast::Type {
2127
ast_from_text(&format!("impl {} for D {{}};", text))
2228
}

0 commit comments

Comments
 (0)