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