diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index ba55f1c42..4a6f41ee7 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -17,14 +17,17 @@ impl AstNode for Stmt { | |||
17 | fn can_cast(kind: SyntaxKind) -> bool { | 17 | fn can_cast(kind: SyntaxKind) -> bool { |
18 | match kind { | 18 | match kind { |
19 | LET_STMT | EXPR_STMT => true, | 19 | LET_STMT | EXPR_STMT => true, |
20 | _ => false, | 20 | _ => Item::can_cast(kind), |
21 | } | 21 | } |
22 | } | 22 | } |
23 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 23 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
24 | let res = match syntax.kind() { | 24 | let res = match syntax.kind() { |
25 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), | 25 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), |
26 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), | 26 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), |
27 | _ => return None, | 27 | _ => { |
28 | let item = Item::cast(syntax)?; | ||
29 | Stmt::Item(item) | ||
30 | } | ||
28 | }; | 31 | }; |
29 | Some(res) | 32 | Some(res) |
30 | } | 33 | } |
@@ -32,6 +35,7 @@ impl AstNode for Stmt { | |||
32 | match self { | 35 | match self { |
33 | Stmt::LetStmt(it) => &it.syntax, | 36 | Stmt::LetStmt(it) => &it.syntax, |
34 | Stmt::ExprStmt(it) => &it.syntax, | 37 | Stmt::ExprStmt(it) => &it.syntax, |
38 | Stmt::Item(it) => it.syntax(), | ||
35 | } | 39 | } |
36 | } | 40 | } |
37 | } | 41 | } |