Rename expr -> tail_expr

This commit is contained in:
Aleksey Kladov 2021-01-05 15:45:46 +03:00
parent 5c10f2f705
commit f9707cde68
18 changed files with 34 additions and 29 deletions

View file

@ -484,7 +484,7 @@ impl ast::AttrsOwner for BlockExpr {}
impl BlockExpr {
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
pub fn tail_expr(&self) -> Option<Expr> { support::child(&self.syntax) }
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

View file

@ -290,7 +290,7 @@ fn api_walkthrough() {
// Let's get the `1 + 1` expression!
let body: ast::BlockExpr = func.body().unwrap();
let expr: ast::Expr = body.expr().unwrap();
let expr: ast::Expr = body.tail_expr().unwrap();
// Enums are used to group related ast nodes together, and can be used for
// matching. However, because there are no public fields, it's possible to