(&mut self, error: ParseErrorType, ranged: T)
| 666 | } |
| 667 | |
| 668 | fn add_error<T>(&mut self, error: ParseErrorType, ranged: T) |
| 669 | where |
| 670 | T: Ranged, |
| 671 | { |
| 672 | fn inner(errors: &mut Vec<ParseError>, error: ParseErrorType, range: TextRange) { |
| 673 | // Avoid flagging multiple errors at the same location |
| 674 | let is_same_location = errors |
| 675 | .last() |
| 676 | .is_some_and(|last| last.location.start() == range.start()); |
| 677 | |
| 678 | if !is_same_location { |
| 679 | errors.push(ParseError { |
| 680 | error, |
| 681 | location: range, |
| 682 | }); |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | inner(&mut self.errors, error, ranged.range()); |
| 687 | } |
| 688 | |
| 689 | /// Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and |
| 690 | /// [`TextRange`] if its minimum version is less than [`Parser::target_version`]. |
no test coverage detected