Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found, and return whether any comments were found.
(&mut self, range: TextRange)
| 1601 | /// Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found, |
| 1602 | /// and return whether any comments were found. |
| 1603 | fn check_fstring_comments(&mut self, range: TextRange) -> bool { |
| 1604 | let mut has_comments = false; |
| 1605 | |
| 1606 | self.unsupported_syntax_errors.extend( |
| 1607 | self.tokens |
| 1608 | .in_range(range) |
| 1609 | .iter() |
| 1610 | .filter(|token| token.kind().is_comment()) |
| 1611 | .map(|token| { |
| 1612 | has_comments = true; |
| 1613 | UnsupportedSyntaxError { |
| 1614 | kind: UnsupportedSyntaxErrorKind::Pep701FString(FStringKind::Comment), |
| 1615 | range: token.range(), |
| 1616 | target_version: self.options.target_version, |
| 1617 | } |
| 1618 | }), |
| 1619 | ); |
| 1620 | |
| 1621 | has_comments |
| 1622 | } |
| 1623 | |
| 1624 | /// Parses a list of f/t-string elements. |
| 1625 | /// |
no test coverage detected