|
1 | 1 | use oxc_allocator::{Box, Vec};
|
2 | 2 | use oxc_ast::{NONE, ast::*};
|
| 3 | +use oxc_span::GetSpan; |
3 | 4 | use oxc_syntax::operator::UnaryOperator;
|
4 | 5 |
|
5 | 6 | use crate::{
|
@@ -649,9 +650,8 @@ impl<'a> ParserImpl<'a> {
|
649 | 650 | self.bump_any(); // bump `is`
|
650 | 651 | // TODO: this should go through the ast builder.
|
651 | 652 | let parameter_name = TSTypePredicateName::This(this_ty);
|
652 |
| - let type_span = self.start_span(); |
653 | 653 | let ty = self.parse_ts_type();
|
654 |
| - let type_annotation = Some(self.ast.ts_type_annotation(self.end_span(type_span), ty)); |
| 654 | + let type_annotation = Some(self.ast.ts_type_annotation(ty.span(), ty)); |
655 | 655 | self.ast.ts_type_type_predicate(self.end_span(span), parameter_name, false, type_annotation)
|
656 | 656 | }
|
657 | 657 |
|
@@ -1051,10 +1051,9 @@ impl<'a> ParserImpl<'a> {
|
1051 | 1051 | fn parse_type_or_type_predicate(&mut self) -> TSType<'a> {
|
1052 | 1052 | let span = self.start_span();
|
1053 | 1053 | let type_predicate_variable = self.try_parse(Self::parse_type_predicate_prefix);
|
1054 |
| - let type_span = self.start_span(); |
1055 | 1054 | let ty = self.parse_ts_type();
|
1056 | 1055 | if let Some(parameter_name) = type_predicate_variable {
|
1057 |
| - let type_annotation = Some(self.ast.ts_type_annotation(self.end_span(type_span), ty)); |
| 1056 | + let type_annotation = Some(self.ast.ts_type_annotation(ty.span(), ty)); |
1058 | 1057 | return self.ast.ts_type_type_predicate(
|
1059 | 1058 | self.end_span(span),
|
1060 | 1059 | parameter_name,
|
|
0 commit comments