Parses a `with` statement The given `start` offset is the start of either the `with` token or the `async` token if it's an async with statement. # Panics If the parser isn't positioned at a `with` token. See:
(&mut self, start: TextSize)
| 2196 | /// |
| 2197 | /// See: <https://docs.python.org/3/reference/compound_stmts.html#the-with-statement> |
| 2198 | fn parse_with_statement(&mut self, start: TextSize) -> ast::StmtWith { |
| 2199 | self.bump(TokenKind::With); |
| 2200 | |
| 2201 | let mut items = self.parse_with_items(); |
| 2202 | items.shrink_to_fit(); |
| 2203 | |
| 2204 | self.expect(TokenKind::Colon); |
| 2205 | |
| 2206 | let body = self.parse_body(Clause::With); |
| 2207 | |
| 2208 | ast::StmtWith { |
| 2209 | items, |
| 2210 | body, |
| 2211 | is_async: false, |
| 2212 | range: self.node_range(start), |
| 2213 | node_index: AtomicNodeIndex::NONE, |
| 2214 | } |
| 2215 | } |
| 2216 | |
| 2217 | /// Parses a list of with items. |
| 2218 | /// |
no test coverage detected