Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found, and return whether any comments were found.
(&mut self, range: TextRange)
| 1670 | /// Check `range` for comment tokens, report an `UnsupportedSyntaxError` for each one found, |
| 1671 | /// and return whether any comments were found. |
| 1672 | fn check_fstring_comments(&mut self, range: TextRange) -> bool { |
| 1673 | let mut has_comments = false; |
| 1674 | |
| 1675 | self.unsupported_syntax_errors.extend( |
| 1676 | self.tokens |
| 1677 | .in_range(range) |
| 1678 | .iter() |
| 1679 | .filter(|token| token.kind().is_comment()) |
| 1680 | .map(|token| { |
| 1681 | has_comments = true; |
| 1682 | UnsupportedSyntaxError { |
| 1683 | kind: UnsupportedSyntaxErrorKind::Pep701FString(FStringKind::Comment), |
| 1684 | range: token.range(), |
| 1685 | target_version: self.options.target_version, |
| 1686 | } |
| 1687 | }), |
| 1688 | ); |
| 1689 | |
| 1690 | has_comments |
| 1691 | } |
| 1692 | |
| 1693 | /// Parses a list of f/t-string elements. |
| 1694 | /// |
no test coverage detected