internal: introduce ast::make::ext module with common shortcuts

There's a tension between keeping a well-architectured minimal
orthogonal set of constructs, and providing convenience functions.
Relieve this pressure by introducing an dedicated module for
non-orthogonal shortcuts.

This is inspired by the django.shortcuts module which serves a similar
purpose architecturally.
This commit is contained in:
Aleksey Kladov 2021-05-09 19:51:06 +03:00
parent 680a0d54e4
commit 4f3c0adc5a
14 changed files with 104 additions and 117 deletions

View file

@ -175,7 +175,7 @@ impl FunctionBuilder {
}
fn render(self) -> FunctionTemplate {
let placeholder_expr = make::expr_todo();
let placeholder_expr = make::ext::expr_todo();
let fn_body = make::block_expr(vec![], Some(placeholder_expr));
let visibility = if self.needs_pub { Some(make::visibility_pub_crate()) } else { None };
let mut fn_def = make::fn_(