mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
parent
1190dee47f
commit
5847e16a15
11 changed files with 145 additions and 70 deletions
|
|
@ -553,73 +553,75 @@ macro_rules! inherit_variants {
|
|||
/// Inherited from [`TSType`]
|
||||
TSBooleanKeyword(Box<'a, TSBooleanKeyword>) = 2,
|
||||
/// Inherited from [`TSType`]
|
||||
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 3,
|
||||
TSIntrinsicKeyword(Box<'a, TSIntrinsicKeyword>) = 3,
|
||||
/// Inherited from [`TSType`]
|
||||
TSNullKeyword(Box<'a, TSNullKeyword>) = 4,
|
||||
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 4,
|
||||
/// Inherited from [`TSType`]
|
||||
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 5,
|
||||
TSNullKeyword(Box<'a, TSNullKeyword>) = 5,
|
||||
/// Inherited from [`TSType`]
|
||||
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 6,
|
||||
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 6,
|
||||
/// Inherited from [`TSType`]
|
||||
TSStringKeyword(Box<'a, TSStringKeyword>) = 7,
|
||||
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 7,
|
||||
/// Inherited from [`TSType`]
|
||||
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 8,
|
||||
TSStringKeyword(Box<'a, TSStringKeyword>) = 8,
|
||||
/// Inherited from [`TSType`]
|
||||
TSThisType(Box<'a, TSThisType>) = 9,
|
||||
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 9,
|
||||
/// Inherited from [`TSType`]
|
||||
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 10,
|
||||
TSThisType(Box<'a, TSThisType>) = 10,
|
||||
/// Inherited from [`TSType`]
|
||||
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 11,
|
||||
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 11,
|
||||
/// Inherited from [`TSType`]
|
||||
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 12,
|
||||
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 12,
|
||||
/// Inherited from [`TSType`]
|
||||
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 13,
|
||||
|
||||
// Compound
|
||||
/// Inherited from [`TSType`]
|
||||
TSArrayType(Box<'a, TSArrayType<'a>>) = 13,
|
||||
TSArrayType(Box<'a, TSArrayType<'a>>) = 14,
|
||||
/// Inherited from [`TSType`]
|
||||
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 14,
|
||||
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 15,
|
||||
/// Inherited from [`TSType`]
|
||||
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 15,
|
||||
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 16,
|
||||
/// Inherited from [`TSType`]
|
||||
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 16,
|
||||
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 17,
|
||||
/// Inherited from [`TSType`]
|
||||
TSImportType(Box<'a, TSImportType<'a>>) = 17,
|
||||
TSImportType(Box<'a, TSImportType<'a>>) = 18,
|
||||
/// Inherited from [`TSType`]
|
||||
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 18,
|
||||
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 19,
|
||||
/// Inherited from [`TSType`]
|
||||
TSInferType(Box<'a, TSInferType<'a>>) = 19,
|
||||
TSInferType(Box<'a, TSInferType<'a>>) = 20,
|
||||
/// Inherited from [`TSType`]
|
||||
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 20,
|
||||
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 21,
|
||||
/// Inherited from [`TSType`]
|
||||
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 21,
|
||||
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 22,
|
||||
/// Inherited from [`TSType`]
|
||||
TSMappedType(Box<'a, TSMappedType<'a>>) = 22,
|
||||
TSMappedType(Box<'a, TSMappedType<'a>>) = 23,
|
||||
/// Inherited from [`TSType`]
|
||||
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 23,
|
||||
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 24,
|
||||
/// Inherited from [`TSType`]
|
||||
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 24,
|
||||
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 25,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 25,
|
||||
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 26,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTupleType(Box<'a, TSTupleType<'a>>) = 26,
|
||||
TSTupleType(Box<'a, TSTupleType<'a>>) = 27,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 27,
|
||||
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 28,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 28,
|
||||
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 29,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 29,
|
||||
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 30,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 30,
|
||||
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 31,
|
||||
/// Inherited from [`TSType`]
|
||||
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 31,
|
||||
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 32,
|
||||
/// Inherited from [`TSType`]
|
||||
TSUnionType(Box<'a, TSUnionType<'a>>) = 32,
|
||||
TSUnionType(Box<'a, TSUnionType<'a>>) = 33,
|
||||
|
||||
// JSDoc
|
||||
/// Inherited from [`TSType`]
|
||||
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 33,
|
||||
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 34,
|
||||
/// Inherited from [`TSType`]
|
||||
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 34,
|
||||
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 35,
|
||||
|
||||
$($rest)*
|
||||
}
|
||||
|
|
@ -637,6 +639,7 @@ macro_rules! inherit_variants {
|
|||
TSAnyKeyword,
|
||||
TSBigIntKeyword,
|
||||
TSBooleanKeyword,
|
||||
TSIntrinsicKeyword,
|
||||
TSNeverKeyword,
|
||||
TSNullKeyword,
|
||||
TSNumberKeyword,
|
||||
|
|
|
|||
|
|
@ -157,40 +157,41 @@ pub enum TSType<'a> {
|
|||
TSAnyKeyword(Box<'a, TSAnyKeyword>) = 0,
|
||||
TSBigIntKeyword(Box<'a, TSBigIntKeyword>) = 1,
|
||||
TSBooleanKeyword(Box<'a, TSBooleanKeyword>) = 2,
|
||||
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 3,
|
||||
TSNullKeyword(Box<'a, TSNullKeyword>) = 4,
|
||||
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 5,
|
||||
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 6,
|
||||
TSStringKeyword(Box<'a, TSStringKeyword>) = 7,
|
||||
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 8,
|
||||
TSThisType(Box<'a, TSThisType>) = 9,
|
||||
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 10,
|
||||
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 11,
|
||||
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 12,
|
||||
TSIntrinsicKeyword(Box<'a, TSIntrinsicKeyword>) = 3,
|
||||
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 4,
|
||||
TSNullKeyword(Box<'a, TSNullKeyword>) = 5,
|
||||
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 6,
|
||||
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 7,
|
||||
TSStringKeyword(Box<'a, TSStringKeyword>) = 8,
|
||||
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 9,
|
||||
TSThisType(Box<'a, TSThisType>) = 10,
|
||||
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 11,
|
||||
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 12,
|
||||
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 13,
|
||||
// Compound
|
||||
TSArrayType(Box<'a, TSArrayType<'a>>) = 13,
|
||||
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 14,
|
||||
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 15,
|
||||
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 16,
|
||||
TSImportType(Box<'a, TSImportType<'a>>) = 17,
|
||||
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 18,
|
||||
TSInferType(Box<'a, TSInferType<'a>>) = 19,
|
||||
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 20,
|
||||
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 21,
|
||||
TSMappedType(Box<'a, TSMappedType<'a>>) = 22,
|
||||
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 23,
|
||||
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 24,
|
||||
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 25,
|
||||
TSTupleType(Box<'a, TSTupleType<'a>>) = 26,
|
||||
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 27,
|
||||
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 28,
|
||||
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 29,
|
||||
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 30,
|
||||
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 31,
|
||||
TSUnionType(Box<'a, TSUnionType<'a>>) = 32,
|
||||
TSArrayType(Box<'a, TSArrayType<'a>>) = 14,
|
||||
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 15,
|
||||
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 16,
|
||||
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 17,
|
||||
TSImportType(Box<'a, TSImportType<'a>>) = 18,
|
||||
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 19,
|
||||
TSInferType(Box<'a, TSInferType<'a>>) = 20,
|
||||
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 21,
|
||||
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 22,
|
||||
TSMappedType(Box<'a, TSMappedType<'a>>) = 23,
|
||||
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 24,
|
||||
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 25,
|
||||
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 26,
|
||||
TSTupleType(Box<'a, TSTupleType<'a>>) = 27,
|
||||
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 28,
|
||||
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 29,
|
||||
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 30,
|
||||
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 31,
|
||||
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 32,
|
||||
TSUnionType(Box<'a, TSUnionType<'a>>) = 33,
|
||||
// JSDoc
|
||||
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 33,
|
||||
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 34,
|
||||
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 34,
|
||||
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 35,
|
||||
}
|
||||
|
||||
/// Macro for matching `TSType`'s variants.
|
||||
|
|
@ -200,6 +201,7 @@ macro_rules! match_ts_type {
|
|||
$ty::TSAnyKeyword(_)
|
||||
| $ty::TSBigIntKeyword(_)
|
||||
| $ty::TSBooleanKeyword(_)
|
||||
| $ty::TSIntrinsicKeyword(_)
|
||||
| $ty::TSNeverKeyword(_)
|
||||
| $ty::TSNullKeyword(_)
|
||||
| $ty::TSNumberKeyword(_)
|
||||
|
|
@ -491,6 +493,16 @@ pub struct TSNeverKeyword {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
/// `type Uppercase<T extends character> = intrinsic;`
|
||||
#[visited_node]
|
||||
#[derive(Debug, Hash)]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
|
||||
#[cfg_attr(feature = "serialize", serde(tag = "type"))]
|
||||
pub struct TSIntrinsicKeyword {
|
||||
#[cfg_attr(feature = "serialize", serde(flatten))]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[visited_node]
|
||||
#[derive(Debug, Hash)]
|
||||
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
|
||||
|
|
|
|||
|
|
@ -1979,6 +1979,11 @@ impl<'a> AstBuilder<'a> {
|
|||
TSType::TSNeverKeyword(self.alloc(TSNeverKeyword { span }))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ts_intrinsic_keyword(self, span: Span) -> TSType<'a> {
|
||||
TSType::TSIntrinsicKeyword(self.alloc(TSIntrinsicKeyword { span }))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ts_template_literal_type(
|
||||
self,
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ ast_kinds! {
|
|||
TSAnyKeyword(&'a TSAnyKeyword),
|
||||
TSBigIntKeyword(&'a TSBigIntKeyword),
|
||||
TSBooleanKeyword(&'a TSBooleanKeyword),
|
||||
TSIntrinsicKeyword(&'a TSIntrinsicKeyword),
|
||||
TSNeverKeyword(&'a TSNeverKeyword),
|
||||
TSNullKeyword(&'a TSNullKeyword),
|
||||
TSNumberKeyword(&'a TSNumberKeyword),
|
||||
|
|
@ -251,12 +252,12 @@ impl<'a> AstKind<'a> {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn is_type(self) -> bool {
|
||||
matches!(self, Self::TSAnyKeyword(_) | Self::TSBigIntKeyword(_) | Self::TSBooleanKeyword(_) | Self::TSNeverKeyword(_)
|
||||
| Self::TSNullKeyword(_) | Self::TSNumberKeyword(_) | Self::TSObjectKeyword(_) | Self::TSStringKeyword(_)
|
||||
| Self::TSSymbolKeyword(_) | Self::TSUndefinedKeyword(_) | Self::TSUnknownKeyword(_) | Self::TSVoidKeyword(_)
|
||||
| Self::TSIndexedAccessType(_) | Self::TSInferType(_) | Self::TSIntersectionType(_) | Self::TSLiteralType(_)
|
||||
| Self::TSMethodSignature(_) | Self::TSTemplateLiteralType(_) | Self::TSThisType(_) | Self::TSTypeLiteral(_)
|
||||
| Self::TSTypeReference(_) | Self::TSUnionType(_))
|
||||
matches!(self, Self::TSAnyKeyword(_) | Self::TSBigIntKeyword(_) | Self::TSBooleanKeyword(_) | Self::TSIntrinsicKeyword(_)
|
||||
| Self::TSNeverKeyword(_) | Self::TSNullKeyword(_) | Self::TSNumberKeyword(_) | Self::TSObjectKeyword(_)
|
||||
| Self::TSStringKeyword(_) | Self::TSSymbolKeyword(_) | Self::TSUndefinedKeyword(_) | Self::TSUnknownKeyword(_)
|
||||
| Self::TSVoidKeyword(_) | Self::TSIndexedAccessType(_) | Self::TSInferType(_) | Self::TSIntersectionType(_)
|
||||
| Self::TSLiteralType(_) | Self::TSMethodSignature(_) | Self::TSTemplateLiteralType(_) | Self::TSThisType(_)
|
||||
| Self::TSTypeLiteral(_) | Self::TSTypeReference(_) | Self::TSUnionType(_))
|
||||
}
|
||||
|
||||
pub fn is_literal(self) -> bool {
|
||||
|
|
@ -497,6 +498,7 @@ impl<'a> GetSpan for AstKind<'a> {
|
|||
Self::TSVoidKeyword(x) => x.span,
|
||||
Self::TSBigIntKeyword(x) => x.span,
|
||||
Self::TSBooleanKeyword(x) => x.span,
|
||||
Self::TSIntrinsicKeyword(x) => x.span,
|
||||
Self::TSNeverKeyword(x) => x.span,
|
||||
Self::TSNumberKeyword(x) => x.span,
|
||||
Self::TSObjectKeyword(x) => x.span,
|
||||
|
|
@ -698,6 +700,7 @@ impl<'a> AstKind<'a> {
|
|||
Self::TSVoidKeyword(_) => "TSVoidKeyword".into(),
|
||||
Self::TSBigIntKeyword(_) => "TSBigIntKeyword".into(),
|
||||
Self::TSBooleanKeyword(_) => "TSBooleanKeyword".into(),
|
||||
Self::TSIntrinsicKeyword(_) => "TSIntrinsicKeyword".into(),
|
||||
Self::TSNeverKeyword(_) => "TSNeverKeyword".into(),
|
||||
Self::TSNumberKeyword(_) => "TSNumberKeyword".into(),
|
||||
Self::TSObjectKeyword(_) => "TSObjectKeyword".into(),
|
||||
|
|
|
|||
|
|
@ -549,6 +549,7 @@ impl<'a> GetSpan for TSType<'a> {
|
|||
Self::TSStringKeyword(t) => t.span,
|
||||
Self::TSNeverKeyword(t) => t.span,
|
||||
Self::TSBooleanKeyword(t) => t.span,
|
||||
Self::TSIntrinsicKeyword(t) => t.span,
|
||||
Self::TSSymbolKeyword(t) => t.span,
|
||||
Self::TSBigIntKeyword(t) => t.span,
|
||||
Self::TSThisType(t) => t.span,
|
||||
|
|
|
|||
|
|
@ -713,6 +713,10 @@ pub trait Visit<'a>: Sized {
|
|||
walk_ts_boolean_keyword(self, ty);
|
||||
}
|
||||
|
||||
fn visit_ts_intrinsic_keyword(&mut self, ty: &TSIntrinsicKeyword) {
|
||||
walk_ts_intrinsic_keyword(self, ty);
|
||||
}
|
||||
|
||||
fn visit_ts_never_keyword(&mut self, ty: &TSNeverKeyword) {
|
||||
walk_ts_never_keyword(self, ty);
|
||||
}
|
||||
|
|
@ -2690,6 +2694,7 @@ pub mod walk {
|
|||
TSType::TSAnyKeyword(ty) => visitor.visit_ts_any_keyword(ty),
|
||||
TSType::TSBigIntKeyword(ty) => visitor.visit_ts_big_int_keyword(ty),
|
||||
TSType::TSBooleanKeyword(ty) => visitor.visit_ts_boolean_keyword(ty),
|
||||
TSType::TSIntrinsicKeyword(ty) => visitor.visit_ts_intrinsic_keyword(ty),
|
||||
TSType::TSNeverKeyword(ty) => visitor.visit_ts_never_keyword(ty),
|
||||
TSType::TSNullKeyword(ty) => visitor.visit_ts_null_keyword(ty),
|
||||
TSType::TSNumberKeyword(ty) => visitor.visit_ts_number_keyword(ty),
|
||||
|
|
@ -3069,6 +3074,12 @@ pub mod walk {
|
|||
visitor.leave_node(kind);
|
||||
}
|
||||
|
||||
pub fn walk_ts_intrinsic_keyword<'a, V: Visit<'a>>(visitor: &mut V, ty: &TSIntrinsicKeyword) {
|
||||
let kind = AstKind::TSIntrinsicKeyword(visitor.alloc(ty));
|
||||
visitor.enter_node(kind);
|
||||
visitor.leave_node(kind);
|
||||
}
|
||||
|
||||
pub fn walk_ts_never_keyword<'a, V: Visit<'a>>(visitor: &mut V, ty: &TSNeverKeyword) {
|
||||
let kind = AstKind::TSNeverKeyword(visitor.alloc(ty));
|
||||
visitor.enter_node(kind);
|
||||
|
|
|
|||
|
|
@ -2662,6 +2662,7 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSType<'a> {
|
|||
Self::TSAnyKeyword(_) => p.print_str(b"any"),
|
||||
Self::TSBigIntKeyword(_) => p.print_str(b"bigint"),
|
||||
Self::TSBooleanKeyword(_) => p.print_str(b"boolean"),
|
||||
Self::TSIntrinsicKeyword(_) => p.print_str(b"intrinsic"),
|
||||
Self::TSNeverKeyword(_) => p.print_str(b"never"),
|
||||
Self::TSNullKeyword(_) => p.print_str(b"null"),
|
||||
Self::TSNumberKeyword(_) => p.print_str(b"number"),
|
||||
|
|
|
|||
|
|
@ -476,6 +476,10 @@ impl<'a> ParserImpl<'a> {
|
|||
self.bump_any();
|
||||
Some(self.ast.ts_never_keyword(self.end_span(span)))
|
||||
}
|
||||
Kind::Intrinsic => {
|
||||
self.bump_any();
|
||||
Some(self.ast.ts_intrinsic_keyword(self.end_span(span)))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -655,6 +655,7 @@ impl<'a> Format<'a> for TSType<'a> {
|
|||
TSType::TSAnyKeyword(v) => v.format(p),
|
||||
TSType::TSBigIntKeyword(v) => v.format(p),
|
||||
TSType::TSBooleanKeyword(v) => v.format(p),
|
||||
TSType::TSIntrinsicKeyword(v) => v.format(p),
|
||||
TSType::TSNeverKeyword(v) => v.format(p),
|
||||
TSType::TSNullKeyword(v) => v.format(p),
|
||||
TSType::TSNumberKeyword(v) => v.format(p),
|
||||
|
|
@ -709,6 +710,12 @@ impl<'a> Format<'a> for TSBooleanKeyword {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Format<'a> for TSIntrinsicKeyword {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Str("intrinsic")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Format<'a> for TSNeverKeyword {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Str("never")
|
||||
|
|
|
|||
|
|
@ -1727,6 +1727,21 @@ pub trait Traverse<'a> {
|
|||
#[inline]
|
||||
fn exit_ts_never_keyword(&mut self, node: &mut TSNeverKeyword, ctx: &mut TraverseCtx<'a>) {}
|
||||
|
||||
#[inline]
|
||||
fn enter_ts_intrinsic_keyword(
|
||||
&mut self,
|
||||
node: &mut TSIntrinsicKeyword,
|
||||
ctx: &mut TraverseCtx<'a>,
|
||||
) {
|
||||
}
|
||||
#[inline]
|
||||
fn exit_ts_intrinsic_keyword(
|
||||
&mut self,
|
||||
node: &mut TSIntrinsicKeyword,
|
||||
ctx: &mut TraverseCtx<'a>,
|
||||
) {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn enter_ts_unknown_keyword(&mut self, node: &mut TSUnknownKeyword, ctx: &mut TraverseCtx<'a>) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3814,6 +3814,9 @@ pub(crate) unsafe fn walk_ts_type<'a, Tr: Traverse<'a>>(
|
|||
TSType::TSBooleanKeyword(node) => {
|
||||
walk_ts_boolean_keyword(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
TSType::TSIntrinsicKeyword(node) => {
|
||||
walk_ts_intrinsic_keyword(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
TSType::TSNeverKeyword(node) => {
|
||||
walk_ts_never_keyword(traverser, (&mut **node) as *mut _, ctx)
|
||||
}
|
||||
|
|
@ -4122,6 +4125,7 @@ pub(crate) unsafe fn walk_ts_tuple_element<'a, Tr: Traverse<'a>>(
|
|||
TSTupleElement::TSAnyKeyword(_)
|
||||
| TSTupleElement::TSBigIntKeyword(_)
|
||||
| TSTupleElement::TSBooleanKeyword(_)
|
||||
| TSTupleElement::TSIntrinsicKeyword(_)
|
||||
| TSTupleElement::TSNeverKeyword(_)
|
||||
| TSTupleElement::TSNullKeyword(_)
|
||||
| TSTupleElement::TSNumberKeyword(_)
|
||||
|
|
@ -4203,6 +4207,15 @@ pub(crate) unsafe fn walk_ts_never_keyword<'a, Tr: Traverse<'a>>(
|
|||
traverser.exit_ts_never_keyword(&mut *node, ctx);
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn walk_ts_intrinsic_keyword<'a, Tr: Traverse<'a>>(
|
||||
traverser: &mut Tr,
|
||||
node: *mut TSIntrinsicKeyword,
|
||||
ctx: &mut TraverseCtx<'a>,
|
||||
) {
|
||||
traverser.enter_ts_intrinsic_keyword(&mut *node, ctx);
|
||||
traverser.exit_ts_intrinsic_keyword(&mut *node, ctx);
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn walk_ts_unknown_keyword<'a, Tr: Traverse<'a>>(
|
||||
traverser: &mut Tr,
|
||||
node: *mut TSUnknownKeyword,
|
||||
|
|
|
|||
Loading…
Reference in a new issue