diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser/grammar/items/mod.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 9147df87d..12bcf7924 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs | |||
@@ -248,16 +248,19 @@ fn fn_item(p: &mut Parser) { | |||
248 | while !p.at(EOF) && !p.at(R_CURLY) { | 248 | while !p.at(EOF) && !p.at(R_CURLY) { |
249 | match p.current() { | 249 | match p.current() { |
250 | LET_KW => let_stmt(p), | 250 | LET_KW => let_stmt(p), |
251 | _ => { | 251 | c => { |
252 | let expr_stmt = p.start(); | 252 | // test block_items |
253 | expressions::expr(p); | 253 | // fn a() { fn b() {} } |
254 | if p.eat(SEMI) { | 254 | if ITEM_FIRST.contains(c) { |
255 | expr_stmt.complete(p, EXPR_STMT); | 255 | item(p) |
256 | if p.at(R_CURLY) { | ||
257 | break; | ||
258 | } | ||
259 | } else { | 256 | } else { |
260 | expr_stmt.abandon(p); | 257 | let expr_stmt = p.start(); |
258 | expressions::expr(p); | ||
259 | if p.eat(SEMI) { | ||
260 | expr_stmt.complete(p, EXPR_STMT); | ||
261 | } else { | ||
262 | expr_stmt.abandon(p); | ||
263 | } | ||
261 | } | 264 | } |
262 | } | 265 | } |
263 | } | 266 | } |