(&mut self, error: ParseErrorType, ranged: T)
| 632 | } |
| 633 | |
| 634 | fn add_error<T>(&mut self, error: ParseErrorType, ranged: T) |
| 635 | where |
| 636 | T: Ranged, |
| 637 | { |
| 638 | fn inner(errors: &mut Vec<ParseError>, error: ParseErrorType, range: TextRange) { |
| 639 | // Avoid flagging multiple errors at the same location |
| 640 | let is_same_location = errors |
| 641 | .last() |
| 642 | .is_some_and(|last| last.location.start() == range.start()); |
| 643 | |
| 644 | if !is_same_location { |
| 645 | errors.push(ParseError { |
| 646 | error, |
| 647 | location: range, |
| 648 | }); |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | inner(&mut self.errors, error, ranged.range()); |
| 653 | } |
| 654 | |
| 655 | /// Add an [`UnsupportedSyntaxError`] with the given [`UnsupportedSyntaxErrorKind`] and |
| 656 | /// [`TextRange`] if its minimum version is less than [`Parser::target_version`]. |
no test coverage detected