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