(&mut self)
| 1224 | } |
| 1225 | |
| 1226 | fn block(&mut self) -> Vec<Stmt<'gc>> { |
| 1227 | let mut statements = Vec::new(); |
| 1228 | |
| 1229 | while !self.check(TokenType::CloseBrace) && !self.is_at_end() { |
| 1230 | if let Some(declaration) = self.declaration() { |
| 1231 | statements.push(declaration); |
| 1232 | } |
| 1233 | } |
| 1234 | |
| 1235 | self.consume(TokenType::CloseBrace, "Expect '}' after block."); |
| 1236 | statements |
| 1237 | } |
| 1238 | |
| 1239 | // Parse block expression. The different between block_expr() and block() are: |
| 1240 | // - block_expr() will treat the last line as an expression if it not ends with semicolon. |
no test coverage detected