about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-23 10:02:11 +0000
committerGitHub <noreply@github.com>2020-12-23 10:02:11 +0000
commitb0d81d98dbc4cea6920793c7e2952a0d38ec543e (patch)
tree52cdc08fd274687db2b6d378f09cca5fd951e405
parentee06096b0c40f4eba5ecd3c3e80f7951587d8047 (diff)
parentf00f75a078ba15131f328eff8532776fbc3a6f9a (diff)
Merge #7017
7017: Document `make` module design r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
-rw-r--r--crates/syntax/src/ast/make.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index ba7e5d2fb10..cafa4c19892 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -4,6 +4,11 @@
 //! Note that all functions here intended to be stupid constructors, which just
 //! assemble a finish node from immediate children. If you want to do something
 //! smarter than that, it probably doesn't belong in this module.
+//!
+//! Keep in mind that `from_text` functions should be kept private. The public
+//! API should require to assemble every node piecewise. The trick of
+//! `parse(format!())` we use internally is an implementation detail -- long
+//! term, it will be replaced with direct tree manipulation.
 use itertools::Itertools;
 use stdx::format_to;
 
@@ -16,7 +21,8 @@ pub fn name(text: &str) -> ast::Name {
 pub fn name_ref(text: &str) -> ast::NameRef {
     ast_from_text(&format!("fn f() {{ {}; }}", text))
 }
-
+// FIXME: replace stringly-typed constructor with a family of typed ctors, a-la
+// `expr_xxx`.
 pub fn ty(text: &str) -> ast::Type {
     ast_from_text(&format!("impl {} for D {{}};", text))
 }