aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs31
1 files changed, 30 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index b937fe5a2..1dd161f52 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -116,9 +116,13 @@ impl<'a> AstNode<'a> for Block<'a> {
116} 116}
117 117
118impl<'a> Block<'a> { 118impl<'a> Block<'a> {
119 pub fn let_stmts(self) -> impl Iterator<Item = LetStmt<'a>> + 'a { 119 pub fn statements(self) -> impl Iterator<Item = Stmt<'a>> + 'a {
120 super::children(self) 120 super::children(self)
121 } 121 }
122
123 pub fn expr(self) -> Option<Expr<'a>> {
124 super::child_opt(self)
125 }
122} 126}
123 127
124// BlockExpr 128// BlockExpr
@@ -1370,6 +1374,31 @@ impl<'a> ast::TypeParamsOwner<'a> for StaticDef<'a> {}
1370impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {} 1374impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {}
1371impl<'a> StaticDef<'a> {} 1375impl<'a> StaticDef<'a> {}
1372 1376
1377// Stmt
1378#[derive(Debug, Clone, Copy)]
1379pub enum Stmt<'a> {
1380 ExprStmt(ExprStmt<'a>),
1381 LetStmt(LetStmt<'a>),
1382}
1383
1384impl<'a> AstNode<'a> for Stmt<'a> {
1385 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1386 match syntax.kind() {
1387 EXPR_STMT => Some(Stmt::ExprStmt(ExprStmt { syntax })),
1388 LET_STMT => Some(Stmt::LetStmt(LetStmt { syntax })),
1389 _ => None,
1390 }
1391 }
1392 fn syntax(self) -> SyntaxNodeRef<'a> {
1393 match self {
1394 Stmt::ExprStmt(inner) => inner.syntax(),
1395 Stmt::LetStmt(inner) => inner.syntax(),
1396 }
1397 }
1398}
1399
1400impl<'a> Stmt<'a> {}
1401
1373// StructDef 1402// StructDef
1374#[derive(Debug, Clone, Copy)] 1403#[derive(Debug, Clone, Copy)]
1375pub struct StructDef<'a> { 1404pub struct StructDef<'a> {