diff options
author | Aleksey Kladov <[email protected]> | 2019-09-02 17:42:14 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-02 18:15:51 +0100 |
commit | dcf8e895038a7677711b8168ee12e1d47f6018bc (patch) | |
tree | 243fb4eed6602a47fa8594bbf9879b7be31aa721 /crates | |
parent | 470fc4765cd3ccc764d3265034d18766374371aa (diff) |
fix generated AST
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 7f91417c5..fd85a3231 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1003,7 +1003,7 @@ impl FnDef { | |||
1003 | pub fn param_list(&self) -> Option<ParamList> { | 1003 | pub fn param_list(&self) -> Option<ParamList> { |
1004 | AstChildren::new(&self.syntax).next() | 1004 | AstChildren::new(&self.syntax).next() |
1005 | } | 1005 | } |
1006 | pub fn body(&self) -> Option<Block> { | 1006 | pub fn body(&self) -> Option<BlockExpr> { |
1007 | AstChildren::new(&self.syntax).next() | 1007 | AstChildren::new(&self.syntax).next() |
1008 | } | 1008 | } |
1009 | pub fn ret_type(&self) -> Option<RetType> { | 1009 | pub fn ret_type(&self) -> Option<RetType> { |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 9f17a10ed..37166182f 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -275,7 +275,7 @@ Grammar( | |||
275 | "AttrsOwner", | 275 | "AttrsOwner", |
276 | "DocCommentsOwner" | 276 | "DocCommentsOwner" |
277 | ], | 277 | ], |
278 | options: [ "ParamList", ["body", "Block"], "RetType" ], | 278 | options: [ "ParamList", ["body", "BlockExpr"], "RetType" ], |
279 | ), | 279 | ), |
280 | "RetType": (options: ["TypeRef"]), | 280 | "RetType": (options: ["TypeRef"]), |
281 | "StructDef": ( | 281 | "StructDef": ( |
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 2bced1867..edb6076bb 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -203,7 +203,8 @@ fn api_walkthrough() { | |||
203 | assert_eq!(name.text(), "foo"); | 203 | assert_eq!(name.text(), "foo"); |
204 | 204 | ||
205 | // Let's get the `1 + 1` expression! | 205 | // Let's get the `1 + 1` expression! |
206 | let block: ast::Block = func.body().unwrap(); | 206 | let body: ast::BlockExpr = func.body().unwrap(); |
207 | let block = body.block().unwrap(); | ||
207 | let expr: ast::Expr = block.expr().unwrap(); | 208 | let expr: ast::Expr = block.expr().unwrap(); |
208 | 209 | ||
209 | // Enums are used to group related ast nodes together, and can be used for | 210 | // Enums are used to group related ast nodes together, and can be used for |