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)
| 2212 | /// |
| 2213 | /// See: <https://docs.python.org/3/reference/compound_stmts.html#the-with-statement> |
| 2214 | fn parse_with_statement(&mut self, start: TextSize) -> ast::StmtWith { |
| 2215 | self.bump(TokenKind::With); |
| 2216 | |
| 2217 | let mut items = self.parse_with_items(); |
| 2218 | items.shrink_to_fit(); |
| 2219 | |
| 2220 | self.expect(TokenKind::Colon); |
| 2221 | |
| 2222 | let body = self.parse_body(Clause::With); |
| 2223 | |
| 2224 | ast::StmtWith { |
| 2225 | items, |
| 2226 | body, |
| 2227 | is_async: false, |
| 2228 | range: self.node_range(start), |
| 2229 | node_index: AtomicNodeIndex::NONE, |
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | /// Parses a list of with items. |
| 2234 | /// |
no test coverage detected