diff --git a/crates/oxc_ast/src/generated/ast_builder.rs b/crates/oxc_ast/src/generated/ast_builder.rs index 9a7238a4c7f32..2d26906fb05da 100644 --- a/crates/oxc_ast/src/generated/ast_builder.rs +++ b/crates/oxc_ast/src/generated/ast_builder.rs @@ -384,15 +384,6 @@ impl<'a> AstBuilder<'a> { Expression::BooleanLiteral(self.alloc(self.boolean_literal(span, value))) } - /// Convert a [`BooleanLiteral`] into an [`Expression::BooleanLiteral`] - #[inline] - pub fn expression_from_boolean_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, BooleanLiteral>>, - { - Expression::BooleanLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::NullLiteral`] /// /// This node contains a [`NullLiteral`] that will be stored in the memory arena. @@ -404,15 +395,6 @@ impl<'a> AstBuilder<'a> { Expression::NullLiteral(self.alloc(self.null_literal(span))) } - /// Convert a [`NullLiteral`] into an [`Expression::NullLiteral`] - #[inline] - pub fn expression_from_null_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, NullLiteral>>, - { - Expression::NullLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::NumericLiteral`] /// /// This node contains a [`NumericLiteral`] that will be stored in the memory arena. @@ -436,15 +418,6 @@ impl<'a> AstBuilder<'a> { Expression::NumericLiteral(self.alloc(self.numeric_literal(span, value, raw, base))) } - /// Convert a [`NumericLiteral`] into an [`Expression::NumericLiteral`] - #[inline] - pub fn expression_from_numeric_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, NumericLiteral<'a>>>, - { - Expression::NumericLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::BigIntLiteral`] /// /// This node contains a [`BigIntLiteral`] that will be stored in the memory arena. @@ -466,15 +439,6 @@ impl<'a> AstBuilder<'a> { Expression::BigIntLiteral(self.alloc(self.big_int_literal(span, raw, base))) } - /// Convert a [`BigIntLiteral`] into an [`Expression::BigIntLiteral`] - #[inline] - pub fn expression_from_big_int_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, BigIntLiteral<'a>>>, - { - Expression::BigIntLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::RegExpLiteral`] /// /// This node contains a [`RegExpLiteral`] that will be stored in the memory arena. @@ -493,15 +457,6 @@ impl<'a> AstBuilder<'a> { Expression::RegExpLiteral(self.alloc(self.reg_exp_literal(span, value, regex))) } - /// Convert a [`RegExpLiteral`] into an [`Expression::RegExpLiteral`] - #[inline] - pub fn expression_from_reg_exp_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, RegExpLiteral<'a>>>, - { - Expression::RegExpLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::StringLiteral`] /// /// This node contains a [`StringLiteral`] that will be stored in the memory arena. @@ -517,15 +472,6 @@ impl<'a> AstBuilder<'a> { Expression::StringLiteral(self.alloc(self.string_literal(span, value))) } - /// Convert a [`StringLiteral`] into an [`Expression::StringLiteral`] - #[inline] - pub fn expression_from_string_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, StringLiteral<'a>>>, - { - Expression::StringLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TemplateLiteral`] /// /// This node contains a [`TemplateLiteral`] that will be stored in the memory arena. @@ -544,15 +490,6 @@ impl<'a> AstBuilder<'a> { Expression::TemplateLiteral(self.alloc(self.template_literal(span, quasis, expressions))) } - /// Convert a [`TemplateLiteral`] into an [`Expression::TemplateLiteral`] - #[inline] - pub fn expression_from_template_literal(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TemplateLiteral<'a>>>, - { - Expression::TemplateLiteral(inner.into_in(self.allocator)) - } - /// Build an [`Expression::Identifier`] /// /// This node contains an [`IdentifierReference`] that will be stored in the memory arena. @@ -568,15 +505,6 @@ impl<'a> AstBuilder<'a> { Expression::Identifier(self.alloc(self.identifier_reference(span, name))) } - /// Convert an [`IdentifierReference`] into an [`Expression::Identifier`] - #[inline] - pub fn expression_from_identifier_reference(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, IdentifierReference<'a>>>, - { - Expression::Identifier(inner.into_in(self.allocator)) - } - /// Build an [`Expression::MetaProperty`] /// /// This node contains a [`MetaProperty`] that will be stored in the memory arena. @@ -595,15 +523,6 @@ impl<'a> AstBuilder<'a> { Expression::MetaProperty(self.alloc(self.meta_property(span, meta, property))) } - /// Convert a [`MetaProperty`] into an [`Expression::MetaProperty`] - #[inline] - pub fn expression_from_meta_property(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, MetaProperty<'a>>>, - { - Expression::MetaProperty(inner.into_in(self.allocator)) - } - /// Build an [`Expression::Super`] /// /// This node contains a [`Super`] that will be stored in the memory arena. @@ -615,15 +534,6 @@ impl<'a> AstBuilder<'a> { Expression::Super(self.alloc(self.super_(span))) } - /// Convert a [`Super`] into an [`Expression::Super`] - #[inline] - pub fn expression_from_super(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, Super>>, - { - Expression::Super(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ArrayExpression`] /// /// This node contains an [`ArrayExpression`] that will be stored in the memory arena. @@ -646,15 +556,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ArrayExpression`] into an [`Expression::ArrayExpression`] - #[inline] - pub fn expression_from_array(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ArrayExpression<'a>>>, - { - Expression::ArrayExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ArrowFunctionExpression`] /// /// This node contains an [`ArrowFunctionExpression`] that will be stored in the memory arena. @@ -695,15 +596,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ArrowFunctionExpression`] into an [`Expression::ArrowFunctionExpression`] - #[inline] - pub fn expression_from_arrow_function(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ArrowFunctionExpression<'a>>>, - { - Expression::ArrowFunctionExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::AssignmentExpression`] /// /// This node contains an [`AssignmentExpression`] that will be stored in the memory arena. @@ -726,15 +618,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`AssignmentExpression`] into an [`Expression::AssignmentExpression`] - #[inline] - pub fn expression_from_assignment(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, AssignmentExpression<'a>>>, - { - Expression::AssignmentExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::AwaitExpression`] /// /// This node contains an [`AwaitExpression`] that will be stored in the memory arena. @@ -747,15 +630,6 @@ impl<'a> AstBuilder<'a> { Expression::AwaitExpression(self.alloc(self.await_expression(span, argument))) } - /// Convert an [`AwaitExpression`] into an [`Expression::AwaitExpression`] - #[inline] - pub fn expression_from_await(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, AwaitExpression<'a>>>, - { - Expression::AwaitExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::BinaryExpression`] /// /// This node contains a [`BinaryExpression`] that will be stored in the memory arena. @@ -778,15 +652,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`BinaryExpression`] into an [`Expression::BinaryExpression`] - #[inline] - pub fn expression_from_binary(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, BinaryExpression<'a>>>, - { - Expression::BinaryExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::CallExpression`] /// /// This node contains a [`CallExpression`] that will be stored in the memory arena. @@ -818,15 +683,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`CallExpression`] into an [`Expression::CallExpression`] - #[inline] - pub fn expression_from_call(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, CallExpression<'a>>>, - { - Expression::CallExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ChainExpression`] /// /// This node contains a [`ChainExpression`] that will be stored in the memory arena. @@ -839,15 +695,6 @@ impl<'a> AstBuilder<'a> { Expression::ChainExpression(self.alloc(self.chain_expression(span, expression))) } - /// Convert a [`ChainExpression`] into an [`Expression::ChainExpression`] - #[inline] - pub fn expression_from_chain(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ChainExpression<'a>>>, - { - Expression::ChainExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ClassExpression`] /// /// This node contains a [`Class`] that will be stored in the memory arena. @@ -899,15 +746,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Class`] into an [`Expression::ClassExpression`] - #[inline] - pub fn expression_from_class(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, Class<'a>>>, - { - Expression::ClassExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ConditionalExpression`] /// /// This node contains a [`ConditionalExpression`] that will be stored in the memory arena. @@ -930,15 +768,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`ConditionalExpression`] into an [`Expression::ConditionalExpression`] - #[inline] - pub fn expression_from_conditional(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ConditionalExpression<'a>>>, - { - Expression::ConditionalExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::FunctionExpression`] /// /// This node contains a [`Function`] that will be stored in the memory arena. @@ -992,15 +821,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Function`] into an [`Expression::FunctionExpression`] - #[inline] - pub fn expression_from_function(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, Function<'a>>>, - { - Expression::FunctionExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ImportExpression`] /// /// This node contains an [`ImportExpression`] that will be stored in the memory arena. @@ -1019,15 +839,6 @@ impl<'a> AstBuilder<'a> { Expression::ImportExpression(self.alloc(self.import_expression(span, source, arguments))) } - /// Convert an [`ImportExpression`] into an [`Expression::ImportExpression`] - #[inline] - pub fn expression_from_import(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ImportExpression<'a>>>, - { - Expression::ImportExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::LogicalExpression`] /// /// This node contains a [`LogicalExpression`] that will be stored in the memory arena. @@ -1050,15 +861,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`LogicalExpression`] into an [`Expression::LogicalExpression`] - #[inline] - pub fn expression_from_logical(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, LogicalExpression<'a>>>, - { - Expression::LogicalExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::NewExpression`] /// /// This node contains a [`NewExpression`] that will be stored in the memory arena. @@ -1087,15 +889,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`NewExpression`] into an [`Expression::NewExpression`] - #[inline] - pub fn expression_from_new(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, NewExpression<'a>>>, - { - Expression::NewExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ObjectExpression`] /// /// This node contains an [`ObjectExpression`] that will be stored in the memory arena. @@ -1118,15 +911,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ObjectExpression`] into an [`Expression::ObjectExpression`] - #[inline] - pub fn expression_from_object(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ObjectExpression<'a>>>, - { - Expression::ObjectExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ParenthesizedExpression`] /// /// This node contains a [`ParenthesizedExpression`] that will be stored in the memory arena. @@ -1145,15 +929,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`ParenthesizedExpression`] into an [`Expression::ParenthesizedExpression`] - #[inline] - pub fn expression_from_parenthesized(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ParenthesizedExpression<'a>>>, - { - Expression::ParenthesizedExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::SequenceExpression`] /// /// This node contains a [`SequenceExpression`] that will be stored in the memory arena. @@ -1170,15 +945,6 @@ impl<'a> AstBuilder<'a> { Expression::SequenceExpression(self.alloc(self.sequence_expression(span, expressions))) } - /// Convert a [`SequenceExpression`] into an [`Expression::SequenceExpression`] - #[inline] - pub fn expression_from_sequence(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, SequenceExpression<'a>>>, - { - Expression::SequenceExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TaggedTemplateExpression`] /// /// This node contains a [`TaggedTemplateExpression`] that will be stored in the memory arena. @@ -1207,15 +973,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TaggedTemplateExpression`] into an [`Expression::TaggedTemplateExpression`] - #[inline] - pub fn expression_from_tagged_template(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TaggedTemplateExpression<'a>>>, - { - Expression::TaggedTemplateExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::ThisExpression`] /// /// This node contains a [`ThisExpression`] that will be stored in the memory arena. @@ -1227,15 +984,6 @@ impl<'a> AstBuilder<'a> { Expression::ThisExpression(self.alloc(self.this_expression(span))) } - /// Convert a [`ThisExpression`] into an [`Expression::ThisExpression`] - #[inline] - pub fn expression_from_this(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, ThisExpression>>, - { - Expression::ThisExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::UnaryExpression`] /// /// This node contains an [`UnaryExpression`] that will be stored in the memory arena. @@ -1254,15 +1002,6 @@ impl<'a> AstBuilder<'a> { Expression::UnaryExpression(self.alloc(self.unary_expression(span, operator, argument))) } - /// Convert an [`UnaryExpression`] into an [`Expression::UnaryExpression`] - #[inline] - pub fn expression_from_unary(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, UnaryExpression<'a>>>, - { - Expression::UnaryExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::UpdateExpression`] /// /// This node contains an [`UpdateExpression`] that will be stored in the memory arena. @@ -1285,15 +1024,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`UpdateExpression`] into an [`Expression::UpdateExpression`] - #[inline] - pub fn expression_from_update(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, UpdateExpression<'a>>>, - { - Expression::UpdateExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::YieldExpression`] /// /// This node contains a [`YieldExpression`] that will be stored in the memory arena. @@ -1312,15 +1042,6 @@ impl<'a> AstBuilder<'a> { Expression::YieldExpression(self.alloc(self.yield_expression(span, delegate, argument))) } - /// Convert a [`YieldExpression`] into an [`Expression::YieldExpression`] - #[inline] - pub fn expression_from_yield(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, YieldExpression<'a>>>, - { - Expression::YieldExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::PrivateInExpression`] /// /// This node contains a [`PrivateInExpression`] that will be stored in the memory arena. @@ -1343,15 +1064,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`PrivateInExpression`] into an [`Expression::PrivateInExpression`] - #[inline] - pub fn expression_from_private_in(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, PrivateInExpression<'a>>>, - { - Expression::PrivateInExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::JSXElement`] /// /// This node contains a [`JSXElement`] that will be stored in the memory arena. @@ -1381,15 +1093,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXElement`] into an [`Expression::JSXElement`] - #[inline] - pub fn expression_from_jsx_element(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, JSXElement<'a>>>, - { - Expression::JSXElement(inner.into_in(self.allocator)) - } - /// Build an [`Expression::JSXFragment`] /// /// This node contains a [`JSXFragment`] that will be stored in the memory arena. @@ -1415,15 +1118,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXFragment`] into an [`Expression::JSXFragment`] - #[inline] - pub fn expression_from_jsx_fragment(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, JSXFragment<'a>>>, - { - Expression::JSXFragment(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TSAsExpression`] /// /// This node contains a [`TSAsExpression`] that will be stored in the memory arena. @@ -1446,15 +1140,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSAsExpression`] into an [`Expression::TSAsExpression`] - #[inline] - pub fn expression_from_ts_as(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TSAsExpression<'a>>>, - { - Expression::TSAsExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TSSatisfiesExpression`] /// /// This node contains a [`TSSatisfiesExpression`] that will be stored in the memory arena. @@ -1477,15 +1162,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSSatisfiesExpression`] into an [`Expression::TSSatisfiesExpression`] - #[inline] - pub fn expression_from_ts_satisfies(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TSSatisfiesExpression<'a>>>, - { - Expression::TSSatisfiesExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TSTypeAssertion`] /// /// This node contains a [`TSTypeAssertion`] that will be stored in the memory arena. @@ -1508,15 +1184,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypeAssertion`] into an [`Expression::TSTypeAssertion`] - #[inline] - pub fn expression_from_ts_type_assertion(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TSTypeAssertion<'a>>>, - { - Expression::TSTypeAssertion(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TSNonNullExpression`] /// /// This node contains a [`TSNonNullExpression`] that will be stored in the memory arena. @@ -1529,15 +1196,6 @@ impl<'a> AstBuilder<'a> { Expression::TSNonNullExpression(self.alloc(self.ts_non_null_expression(span, expression))) } - /// Convert a [`TSNonNullExpression`] into an [`Expression::TSNonNullExpression`] - #[inline] - pub fn expression_from_ts_non_null(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TSNonNullExpression<'a>>>, - { - Expression::TSNonNullExpression(inner.into_in(self.allocator)) - } - /// Build an [`Expression::TSInstantiationExpression`] /// /// This node contains a [`TSInstantiationExpression`] that will be stored in the memory arena. @@ -1563,21 +1221,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSInstantiationExpression`] into an [`Expression::TSInstantiationExpression`] - #[inline] - pub fn expression_from_ts_instantiation(self, inner: T) -> Expression<'a> - where - T: IntoIn<'a, Box<'a, TSInstantiationExpression<'a>>>, - { - Expression::TSInstantiationExpression(inner.into_in(self.allocator)) - } - - /// Convert a [`MemberExpression`] into the corresponding variant of [`Expression`] without copying or re-allocating memory. - #[inline] - pub fn expression_member(self, inner: MemberExpression<'a>) -> Expression<'a> { - Expression::from(inner) - } - /// Build an [`IdentifierName`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_identifier_name`] instead. @@ -1879,18 +1522,6 @@ impl<'a> AstBuilder<'a> { ArrayExpressionElement::SpreadElement(self.alloc(self.spread_element(span, argument))) } - /// Convert a [`SpreadElement`] into an [`ArrayExpressionElement::SpreadElement`] - #[inline] - pub fn array_expression_element_from_spread_element( - self, - inner: T, - ) -> ArrayExpressionElement<'a> - where - T: IntoIn<'a, Box<'a, SpreadElement<'a>>>, - { - ArrayExpressionElement::SpreadElement(inner.into_in(self.allocator)) - } - /// Build an [`ArrayExpressionElement::Elision`] /// /// ## Parameters @@ -1900,24 +1531,6 @@ impl<'a> AstBuilder<'a> { ArrayExpressionElement::Elision(self.elision(span)) } - /// Convert an [`Elision`] into an [`ArrayExpressionElement::Elision`] - #[inline] - pub fn array_expression_element_from_elision(self, inner: T) -> ArrayExpressionElement<'a> - where - T: IntoIn<'a, Elision>, - { - ArrayExpressionElement::Elision(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`ArrayExpressionElement`] without copying or re-allocating memory. - #[inline] - pub fn array_expression_element_expression( - self, - inner: Expression<'a>, - ) -> ArrayExpressionElement<'a> { - ArrayExpressionElement::from(inner) - } - /// Build an [`Elision`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_elision`] instead. @@ -2008,15 +1621,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`ObjectProperty`] into an [`ObjectPropertyKind::ObjectProperty`] - #[inline] - pub fn object_property_kind_from_object_property(self, inner: T) -> ObjectPropertyKind<'a> - where - T: IntoIn<'a, Box<'a, ObjectProperty<'a>>>, - { - ObjectPropertyKind::ObjectProperty(inner.into_in(self.allocator)) - } - /// Build an [`ObjectPropertyKind::SpreadProperty`] /// /// This node contains a [`SpreadElement`] that will be stored in the memory arena. @@ -2033,15 +1637,6 @@ impl<'a> AstBuilder<'a> { ObjectPropertyKind::SpreadProperty(self.alloc(self.spread_element(span, argument))) } - /// Convert a [`SpreadElement`] into an [`ObjectPropertyKind::SpreadProperty`] - #[inline] - pub fn object_property_kind_from_spread_element(self, inner: T) -> ObjectPropertyKind<'a> - where - T: IntoIn<'a, Box<'a, SpreadElement<'a>>>, - { - ObjectPropertyKind::SpreadProperty(inner.into_in(self.allocator)) - } - /// Build an [`ObjectProperty`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_object_property`] instead. @@ -2116,15 +1711,6 @@ impl<'a> AstBuilder<'a> { PropertyKey::StaticIdentifier(self.alloc(self.identifier_name(span, name))) } - /// Convert an [`IdentifierName`] into a [`PropertyKey::StaticIdentifier`] - #[inline] - pub fn property_key_from_identifier_name(self, inner: T) -> PropertyKey<'a> - where - T: IntoIn<'a, Box<'a, IdentifierName<'a>>>, - { - PropertyKey::StaticIdentifier(inner.into_in(self.allocator)) - } - /// Build a [`PropertyKey::PrivateIdentifier`] /// /// This node contains a [`PrivateIdentifier`] that will be stored in the memory arena. @@ -2140,21 +1726,6 @@ impl<'a> AstBuilder<'a> { PropertyKey::PrivateIdentifier(self.alloc(self.private_identifier(span, name))) } - /// Convert a [`PrivateIdentifier`] into a [`PropertyKey::PrivateIdentifier`] - #[inline] - pub fn property_key_from_private_identifier(self, inner: T) -> PropertyKey<'a> - where - T: IntoIn<'a, Box<'a, PrivateIdentifier<'a>>>, - { - PropertyKey::PrivateIdentifier(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`PropertyKey`] without copying or re-allocating memory. - #[inline] - pub fn property_key_expression(self, inner: Expression<'a>) -> PropertyKey<'a> { - PropertyKey::from(inner) - } - /// Build a [`TemplateLiteral`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_template_literal`] instead. @@ -2303,15 +1874,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`ComputedMemberExpression`] into a [`MemberExpression::ComputedMemberExpression`] - #[inline] - pub fn member_expression_from_computed(self, inner: T) -> MemberExpression<'a> - where - T: IntoIn<'a, Box<'a, ComputedMemberExpression<'a>>>, - { - MemberExpression::ComputedMemberExpression(inner.into_in(self.allocator)) - } - /// Build a [`MemberExpression::StaticMemberExpression`] /// /// This node contains a [`StaticMemberExpression`] that will be stored in the memory arena. @@ -2334,15 +1896,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`StaticMemberExpression`] into a [`MemberExpression::StaticMemberExpression`] - #[inline] - pub fn member_expression_from_static(self, inner: T) -> MemberExpression<'a> - where - T: IntoIn<'a, Box<'a, StaticMemberExpression<'a>>>, - { - MemberExpression::StaticMemberExpression(inner.into_in(self.allocator)) - } - /// Build a [`MemberExpression::PrivateFieldExpression`] /// /// This node contains a [`PrivateFieldExpression`] that will be stored in the memory arena. @@ -2365,18 +1918,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`PrivateFieldExpression`] into a [`MemberExpression::PrivateFieldExpression`] - #[inline] - pub fn member_expression_from_private_field_expression( - self, - inner: T, - ) -> MemberExpression<'a> - where - T: IntoIn<'a, Box<'a, PrivateFieldExpression<'a>>>, - { - MemberExpression::PrivateFieldExpression(inner.into_in(self.allocator)) - } - /// Build a [`ComputedMemberExpression`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_computed_member_expression`] instead. @@ -2686,21 +2227,6 @@ impl<'a> AstBuilder<'a> { Argument::SpreadElement(self.alloc(self.spread_element(span, argument))) } - /// Convert a [`SpreadElement`] into an [`Argument::SpreadElement`] - #[inline] - pub fn argument_from_spread_element(self, inner: T) -> Argument<'a> - where - T: IntoIn<'a, Box<'a, SpreadElement<'a>>>, - { - Argument::SpreadElement(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`Argument`] without copying or re-allocating memory. - #[inline] - pub fn argument_expression(self, inner: Expression<'a>) -> Argument<'a> { - Argument::from(inner) - } - /// Build an [`UpdateExpression`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_update_expression`] instead. @@ -2977,24 +2503,6 @@ impl<'a> AstBuilder<'a> { Box::new_in(self.assignment_expression(span, operator, left, right), self.allocator) } - /// Convert a [`SimpleAssignmentTarget`] into the corresponding variant of [`AssignmentTarget`] without copying or re-allocating memory. - #[inline] - pub fn assignment_target_simple( - self, - inner: SimpleAssignmentTarget<'a>, - ) -> AssignmentTarget<'a> { - AssignmentTarget::from(inner) - } - - /// Convert a [`AssignmentTargetPattern`] into the corresponding variant of [`AssignmentTarget`] without copying or re-allocating memory. - #[inline] - pub fn assignment_target_assignment_target_pattern( - self, - inner: AssignmentTargetPattern<'a>, - ) -> AssignmentTarget<'a> { - AssignmentTarget::from(inner) - } - /// Build a [`SimpleAssignmentTarget::AssignmentTargetIdentifier`] /// /// This node contains an [`IdentifierReference`] that will be stored in the memory arena. @@ -3016,18 +2524,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`IdentifierReference`] into a [`SimpleAssignmentTarget::AssignmentTargetIdentifier`] - #[inline] - pub fn simple_assignment_target_from_identifier_reference( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, IdentifierReference<'a>>>, - { - SimpleAssignmentTarget::AssignmentTargetIdentifier(inner.into_in(self.allocator)) - } - /// Build a [`SimpleAssignmentTarget::TSAsExpression`] /// /// This node contains a [`TSAsExpression`] that will be stored in the memory arena. @@ -3050,18 +2546,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSAsExpression`] into a [`SimpleAssignmentTarget::TSAsExpression`] - #[inline] - pub fn simple_assignment_target_from_ts_as_expression( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, TSAsExpression<'a>>>, - { - SimpleAssignmentTarget::TSAsExpression(inner.into_in(self.allocator)) - } - /// Build a [`SimpleAssignmentTarget::TSSatisfiesExpression`] /// /// This node contains a [`TSSatisfiesExpression`] that will be stored in the memory arena. @@ -3084,18 +2568,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSSatisfiesExpression`] into a [`SimpleAssignmentTarget::TSSatisfiesExpression`] - #[inline] - pub fn simple_assignment_target_from_ts_satisfies_expression( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, TSSatisfiesExpression<'a>>>, - { - SimpleAssignmentTarget::TSSatisfiesExpression(inner.into_in(self.allocator)) - } - /// Build a [`SimpleAssignmentTarget::TSNonNullExpression`] /// /// This node contains a [`TSNonNullExpression`] that will be stored in the memory arena. @@ -3114,18 +2586,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSNonNullExpression`] into a [`SimpleAssignmentTarget::TSNonNullExpression`] - #[inline] - pub fn simple_assignment_target_from_ts_non_null_expression( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, TSNonNullExpression<'a>>>, - { - SimpleAssignmentTarget::TSNonNullExpression(inner.into_in(self.allocator)) - } - /// Build a [`SimpleAssignmentTarget::TSTypeAssertion`] /// /// This node contains a [`TSTypeAssertion`] that will be stored in the memory arena. @@ -3148,18 +2608,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypeAssertion`] into a [`SimpleAssignmentTarget::TSTypeAssertion`] - #[inline] - pub fn simple_assignment_target_from_ts_type_assertion( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, TSTypeAssertion<'a>>>, - { - SimpleAssignmentTarget::TSTypeAssertion(inner.into_in(self.allocator)) - } - /// Build a [`SimpleAssignmentTarget::TSInstantiationExpression`] /// /// This node contains a [`TSInstantiationExpression`] that will be stored in the memory arena. @@ -3183,27 +2631,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSInstantiationExpression`] into a [`SimpleAssignmentTarget::TSInstantiationExpression`] - #[inline] - pub fn simple_assignment_target_from_ts_instantiation_expression( - self, - inner: T, - ) -> SimpleAssignmentTarget<'a> - where - T: IntoIn<'a, Box<'a, TSInstantiationExpression<'a>>>, - { - SimpleAssignmentTarget::TSInstantiationExpression(inner.into_in(self.allocator)) - } - - /// Convert a [`MemberExpression`] into the corresponding variant of [`SimpleAssignmentTarget`] without copying or re-allocating memory. - #[inline] - pub fn simple_assignment_target_member_expression( - self, - inner: MemberExpression<'a>, - ) -> SimpleAssignmentTarget<'a> { - SimpleAssignmentTarget::from(inner) - } - /// Build an [`AssignmentTargetPattern::ArrayAssignmentTarget`] /// /// This node contains an [`ArrayAssignmentTarget`] that will be stored in the memory arena. @@ -3229,18 +2656,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ArrayAssignmentTarget`] into an [`AssignmentTargetPattern::ArrayAssignmentTarget`] - #[inline] - pub fn assignment_target_pattern_from_array_assignment_target( - self, - inner: T, - ) -> AssignmentTargetPattern<'a> - where - T: IntoIn<'a, Box<'a, ArrayAssignmentTarget<'a>>>, - { - AssignmentTargetPattern::ArrayAssignmentTarget(inner.into_in(self.allocator)) - } - /// Build an [`AssignmentTargetPattern::ObjectAssignmentTarget`] /// /// This node contains an [`ObjectAssignmentTarget`] that will be stored in the memory arena. @@ -3261,18 +2676,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`ObjectAssignmentTarget`] into an [`AssignmentTargetPattern::ObjectAssignmentTarget`] - #[inline] - pub fn assignment_target_pattern_from_object_assignment_target( - self, - inner: T, - ) -> AssignmentTargetPattern<'a> - where - T: IntoIn<'a, Box<'a, ObjectAssignmentTarget<'a>>>, - { - AssignmentTargetPattern::ObjectAssignmentTarget(inner.into_in(self.allocator)) - } - /// Build an [`ArrayAssignmentTarget`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_array_assignment_target`] instead. @@ -3404,27 +2807,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`AssignmentTargetWithDefault`] into an [`AssignmentTargetMaybeDefault::AssignmentTargetWithDefault`] - #[inline] - pub fn assignment_target_maybe_default_from_assignment_target_with_default( - self, - inner: T, - ) -> AssignmentTargetMaybeDefault<'a> - where - T: IntoIn<'a, Box<'a, AssignmentTargetWithDefault<'a>>>, - { - AssignmentTargetMaybeDefault::AssignmentTargetWithDefault(inner.into_in(self.allocator)) - } - - /// Convert a [`AssignmentTarget`] into the corresponding variant of [`AssignmentTargetMaybeDefault`] without copying or re-allocating memory. - #[inline] - pub fn assignment_target_maybe_default_assignment_target( - self, - inner: AssignmentTarget<'a>, - ) -> AssignmentTargetMaybeDefault<'a> { - AssignmentTargetMaybeDefault::from(inner) - } - /// Build an [`AssignmentTargetWithDefault`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_assignment_target_with_default`] instead. @@ -3481,18 +2863,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`AssignmentTargetPropertyIdentifier`] into an [`AssignmentTargetProperty::AssignmentTargetPropertyIdentifier`] - #[inline] - pub fn assignment_target_property_from_assignment_target_property_identifier( - self, - inner: T, - ) -> AssignmentTargetProperty<'a> - where - T: IntoIn<'a, Box<'a, AssignmentTargetPropertyIdentifier<'a>>>, - { - AssignmentTargetProperty::AssignmentTargetPropertyIdentifier(inner.into_in(self.allocator)) - } - /// Build an [`AssignmentTargetProperty::AssignmentTargetPropertyProperty`] /// /// This node contains an [`AssignmentTargetPropertyProperty`] that will be stored in the memory arena. @@ -3513,18 +2883,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`AssignmentTargetPropertyProperty`] into an [`AssignmentTargetProperty::AssignmentTargetPropertyProperty`] - #[inline] - pub fn assignment_target_property_from_assignment_target_property_property( - self, - inner: T, - ) -> AssignmentTargetProperty<'a> - where - T: IntoIn<'a, Box<'a, AssignmentTargetPropertyProperty<'a>>>, - { - AssignmentTargetProperty::AssignmentTargetPropertyProperty(inner.into_in(self.allocator)) - } - /// Build an [`AssignmentTargetPropertyIdentifier`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_assignment_target_property_identifier`] instead. @@ -3738,21 +3096,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`CallExpression`] into a [`ChainElement::CallExpression`] - #[inline] - pub fn chain_element_from_call_expression(self, inner: T) -> ChainElement<'a> - where - T: IntoIn<'a, Box<'a, CallExpression<'a>>>, - { - ChainElement::CallExpression(inner.into_in(self.allocator)) - } - - /// Convert a [`MemberExpression`] into the corresponding variant of [`ChainElement`] without copying or re-allocating memory. - #[inline] - pub fn chain_element_member_expression(self, inner: MemberExpression<'a>) -> ChainElement<'a> { - ChainElement::from(inner) - } - /// Build a [`ParenthesizedExpression`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_parenthesized_expression`] instead. @@ -3797,15 +3140,6 @@ impl<'a> AstBuilder<'a> { Statement::BlockStatement(self.alloc(self.block_statement(span, body))) } - /// Convert a [`BlockStatement`] into a [`Statement::BlockStatement`] - #[inline] - pub fn statement_from_block(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, BlockStatement<'a>>>, - { - Statement::BlockStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::BreakStatement`] /// /// This node contains a [`BreakStatement`] that will be stored in the memory arena. @@ -3818,15 +3152,6 @@ impl<'a> AstBuilder<'a> { Statement::BreakStatement(self.alloc(self.break_statement(span, label))) } - /// Convert a [`BreakStatement`] into a [`Statement::BreakStatement`] - #[inline] - pub fn statement_from_break(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, BreakStatement<'a>>>, - { - Statement::BreakStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ContinueStatement`] /// /// This node contains a [`ContinueStatement`] that will be stored in the memory arena. @@ -3843,15 +3168,6 @@ impl<'a> AstBuilder<'a> { Statement::ContinueStatement(self.alloc(self.continue_statement(span, label))) } - /// Convert a [`ContinueStatement`] into a [`Statement::ContinueStatement`] - #[inline] - pub fn statement_from_continue(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ContinueStatement<'a>>>, - { - Statement::ContinueStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::DebuggerStatement`] /// /// This node contains a [`DebuggerStatement`] that will be stored in the memory arena. @@ -3863,15 +3179,6 @@ impl<'a> AstBuilder<'a> { Statement::DebuggerStatement(self.alloc(self.debugger_statement(span))) } - /// Convert a [`DebuggerStatement`] into a [`Statement::DebuggerStatement`] - #[inline] - pub fn statement_from_debugger(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, DebuggerStatement>>, - { - Statement::DebuggerStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::DoWhileStatement`] /// /// This node contains a [`DoWhileStatement`] that will be stored in the memory arena. @@ -3890,15 +3197,6 @@ impl<'a> AstBuilder<'a> { Statement::DoWhileStatement(self.alloc(self.do_while_statement(span, body, test))) } - /// Convert a [`DoWhileStatement`] into a [`Statement::DoWhileStatement`] - #[inline] - pub fn statement_from_do_while(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, DoWhileStatement<'a>>>, - { - Statement::DoWhileStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::EmptyStatement`] /// /// This node contains an [`EmptyStatement`] that will be stored in the memory arena. @@ -3910,15 +3208,6 @@ impl<'a> AstBuilder<'a> { Statement::EmptyStatement(self.alloc(self.empty_statement(span))) } - /// Convert an [`EmptyStatement`] into a [`Statement::EmptyStatement`] - #[inline] - pub fn statement_from_empty(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, EmptyStatement>>, - { - Statement::EmptyStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ExpressionStatement`] /// /// This node contains an [`ExpressionStatement`] that will be stored in the memory arena. @@ -3931,15 +3220,6 @@ impl<'a> AstBuilder<'a> { Statement::ExpressionStatement(self.alloc(self.expression_statement(span, expression))) } - /// Convert an [`ExpressionStatement`] into a [`Statement::ExpressionStatement`] - #[inline] - pub fn statement_from_expression(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ExpressionStatement<'a>>>, - { - Statement::ExpressionStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ForInStatement`] /// /// This node contains a [`ForInStatement`] that will be stored in the memory arena. @@ -3960,15 +3240,6 @@ impl<'a> AstBuilder<'a> { Statement::ForInStatement(self.alloc(self.for_in_statement(span, left, right, body))) } - /// Convert a [`ForInStatement`] into a [`Statement::ForInStatement`] - #[inline] - pub fn statement_from_for_in(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ForInStatement<'a>>>, - { - Statement::ForInStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ForOfStatement`] /// /// This node contains a [`ForOfStatement`] that will be stored in the memory arena. @@ -3993,15 +3264,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`ForOfStatement`] into a [`Statement::ForOfStatement`] - #[inline] - pub fn statement_from_for_of(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ForOfStatement<'a>>>, - { - Statement::ForOfStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ForStatement`] /// /// This node contains a [`ForStatement`] that will be stored in the memory arena. @@ -4024,15 +3286,6 @@ impl<'a> AstBuilder<'a> { Statement::ForStatement(self.alloc(self.for_statement(span, init, test, update, body))) } - /// Convert a [`ForStatement`] into a [`Statement::ForStatement`] - #[inline] - pub fn statement_from_for(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ForStatement<'a>>>, - { - Statement::ForStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::IfStatement`] /// /// This node contains an [`IfStatement`] that will be stored in the memory arena. @@ -4053,15 +3306,6 @@ impl<'a> AstBuilder<'a> { Statement::IfStatement(self.alloc(self.if_statement(span, test, consequent, alternate))) } - /// Convert an [`IfStatement`] into a [`Statement::IfStatement`] - #[inline] - pub fn statement_from_if(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, IfStatement<'a>>>, - { - Statement::IfStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::LabeledStatement`] /// /// This node contains a [`LabeledStatement`] that will be stored in the memory arena. @@ -4080,15 +3324,6 @@ impl<'a> AstBuilder<'a> { Statement::LabeledStatement(self.alloc(self.labeled_statement(span, label, body))) } - /// Convert a [`LabeledStatement`] into a [`Statement::LabeledStatement`] - #[inline] - pub fn statement_from_labeled(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, LabeledStatement<'a>>>, - { - Statement::LabeledStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ReturnStatement`] /// /// This node contains a [`ReturnStatement`] that will be stored in the memory arena. @@ -4101,15 +3336,6 @@ impl<'a> AstBuilder<'a> { Statement::ReturnStatement(self.alloc(self.return_statement(span, argument))) } - /// Convert a [`ReturnStatement`] into a [`Statement::ReturnStatement`] - #[inline] - pub fn statement_from_return(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ReturnStatement<'a>>>, - { - Statement::ReturnStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::SwitchStatement`] /// /// This node contains a [`SwitchStatement`] that will be stored in the memory arena. @@ -4128,15 +3354,6 @@ impl<'a> AstBuilder<'a> { Statement::SwitchStatement(self.alloc(self.switch_statement(span, discriminant, cases))) } - /// Convert a [`SwitchStatement`] into a [`Statement::SwitchStatement`] - #[inline] - pub fn statement_from_switch(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, SwitchStatement<'a>>>, - { - Statement::SwitchStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::ThrowStatement`] /// /// This node contains a [`ThrowStatement`] that will be stored in the memory arena. @@ -4149,15 +3366,6 @@ impl<'a> AstBuilder<'a> { Statement::ThrowStatement(self.alloc(self.throw_statement(span, argument))) } - /// Convert a [`ThrowStatement`] into a [`Statement::ThrowStatement`] - #[inline] - pub fn statement_from_throw(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, ThrowStatement<'a>>>, - { - Statement::ThrowStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::TryStatement`] /// /// This node contains a [`TryStatement`] that will be stored in the memory arena. @@ -4183,15 +3391,6 @@ impl<'a> AstBuilder<'a> { Statement::TryStatement(self.alloc(self.try_statement(span, block, handler, finalizer))) } - /// Convert a [`TryStatement`] into a [`Statement::TryStatement`] - #[inline] - pub fn statement_from_try(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, TryStatement<'a>>>, - { - Statement::TryStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::WhileStatement`] /// /// This node contains a [`WhileStatement`] that will be stored in the memory arena. @@ -4210,15 +3409,6 @@ impl<'a> AstBuilder<'a> { Statement::WhileStatement(self.alloc(self.while_statement(span, test, body))) } - /// Convert a [`WhileStatement`] into a [`Statement::WhileStatement`] - #[inline] - pub fn statement_from_while(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, WhileStatement<'a>>>, - { - Statement::WhileStatement(inner.into_in(self.allocator)) - } - /// Build a [`Statement::WithStatement`] /// /// This node contains a [`WithStatement`] that will be stored in the memory arena. @@ -4237,27 +3427,6 @@ impl<'a> AstBuilder<'a> { Statement::WithStatement(self.alloc(self.with_statement(span, object, body))) } - /// Convert a [`WithStatement`] into a [`Statement::WithStatement`] - #[inline] - pub fn statement_from_with(self, inner: T) -> Statement<'a> - where - T: IntoIn<'a, Box<'a, WithStatement<'a>>>, - { - Statement::WithStatement(inner.into_in(self.allocator)) - } - - /// Convert a [`Declaration`] into the corresponding variant of [`Statement`] without copying or re-allocating memory. - #[inline] - pub fn statement_declaration(self, inner: Declaration<'a>) -> Statement<'a> { - Statement::from(inner) - } - - /// Convert a [`ModuleDeclaration`] into the corresponding variant of [`Statement`] without copying or re-allocating memory. - #[inline] - pub fn statement_module_declaration(self, inner: ModuleDeclaration<'a>) -> Statement<'a> { - Statement::from(inner) - } - /// Build a [`Directive`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_directive`] instead. @@ -4419,15 +3588,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`VariableDeclaration`] into a [`Declaration::VariableDeclaration`] - #[inline] - pub fn declaration_from_variable(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, VariableDeclaration<'a>>>, - { - Declaration::VariableDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::FunctionDeclaration`] /// /// This node contains a [`Function`] that will be stored in the memory arena. @@ -4481,15 +3641,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Function`] into a [`Declaration::FunctionDeclaration`] - #[inline] - pub fn declaration_from_function(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, Function<'a>>>, - { - Declaration::FunctionDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::ClassDeclaration`] /// /// This node contains a [`Class`] that will be stored in the memory arena. @@ -4541,15 +3692,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Class`] into a [`Declaration::ClassDeclaration`] - #[inline] - pub fn declaration_from_class(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, Class<'a>>>, - { - Declaration::ClassDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::TSTypeAliasDeclaration`] /// /// This node contains a [`TSTypeAliasDeclaration`] that will be stored in the memory arena. @@ -4581,15 +3723,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypeAliasDeclaration`] into a [`Declaration::TSTypeAliasDeclaration`] - #[inline] - pub fn declaration_from_ts_type_alias(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, TSTypeAliasDeclaration<'a>>>, - { - Declaration::TSTypeAliasDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::TSInterfaceDeclaration`] /// /// This node contains a [`TSInterfaceDeclaration`] that will be stored in the memory arena. @@ -4625,15 +3758,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSInterfaceDeclaration`] into a [`Declaration::TSInterfaceDeclaration`] - #[inline] - pub fn declaration_from_ts_interface(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, TSInterfaceDeclaration<'a>>>, - { - Declaration::TSInterfaceDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::TSEnumDeclaration`] /// /// This node contains a [`TSEnumDeclaration`] that will be stored in the memory arena. @@ -4658,15 +3782,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSEnumDeclaration`] into a [`Declaration::TSEnumDeclaration`] - #[inline] - pub fn declaration_from_ts_enum(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, TSEnumDeclaration<'a>>>, - { - Declaration::TSEnumDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::TSModuleDeclaration`] /// /// This node contains a [`TSModuleDeclaration`] that will be stored in the memory arena. @@ -4691,15 +3806,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSModuleDeclaration`] into a [`Declaration::TSModuleDeclaration`] - #[inline] - pub fn declaration_from_ts_module(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, TSModuleDeclaration<'a>>>, - { - Declaration::TSModuleDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`Declaration::TSImportEqualsDeclaration`] /// /// This node contains a [`TSImportEqualsDeclaration`] that will be stored in the memory arena. @@ -4725,15 +3831,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSImportEqualsDeclaration`] into a [`Declaration::TSImportEqualsDeclaration`] - #[inline] - pub fn declaration_from_ts_import_equals(self, inner: T) -> Declaration<'a> - where - T: IntoIn<'a, Box<'a, TSImportEqualsDeclaration<'a>>>, - { - Declaration::TSImportEqualsDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`VariableDeclaration`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_variable_declaration`] instead. @@ -5104,21 +4201,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`VariableDeclaration`] into a [`ForStatementInit::VariableDeclaration`] - #[inline] - pub fn for_statement_init_from_variable_declaration(self, inner: T) -> ForStatementInit<'a> - where - T: IntoIn<'a, Box<'a, VariableDeclaration<'a>>>, - { - ForStatementInit::VariableDeclaration(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`ForStatementInit`] without copying or re-allocating memory. - #[inline] - pub fn for_statement_init_expression(self, inner: Expression<'a>) -> ForStatementInit<'a> { - ForStatementInit::from(inner) - } - /// Build a [`ForInStatement`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_for_in_statement`] instead. @@ -5231,24 +4313,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`VariableDeclaration`] into a [`ForStatementLeft::VariableDeclaration`] - #[inline] - pub fn for_statement_left_from_variable_declaration(self, inner: T) -> ForStatementLeft<'a> - where - T: IntoIn<'a, Box<'a, VariableDeclaration<'a>>>, - { - ForStatementLeft::VariableDeclaration(inner.into_in(self.allocator)) - } - - /// Convert a [`AssignmentTarget`] into the corresponding variant of [`ForStatementLeft`] without copying or re-allocating memory. - #[inline] - pub fn for_statement_left_assignment_target( - self, - inner: AssignmentTarget<'a>, - ) -> ForStatementLeft<'a> { - ForStatementLeft::from(inner) - } - /// Build a [`ForOfStatement`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_for_of_statement`] instead. @@ -5919,15 +4983,6 @@ impl<'a> AstBuilder<'a> { BindingPatternKind::BindingIdentifier(self.alloc(self.binding_identifier(span, name))) } - /// Convert a [`BindingIdentifier`] into a [`BindingPatternKind::BindingIdentifier`] - #[inline] - pub fn binding_pattern_kind_from_binding_identifier(self, inner: T) -> BindingPatternKind<'a> - where - T: IntoIn<'a, Box<'a, BindingIdentifier<'a>>>, - { - BindingPatternKind::BindingIdentifier(inner.into_in(self.allocator)) - } - /// Build a [`BindingPatternKind::ObjectPattern`] /// /// This node contains an [`ObjectPattern`] that will be stored in the memory arena. @@ -5949,15 +5004,6 @@ impl<'a> AstBuilder<'a> { BindingPatternKind::ObjectPattern(self.alloc(self.object_pattern(span, properties, rest))) } - /// Convert an [`ObjectPattern`] into a [`BindingPatternKind::ObjectPattern`] - #[inline] - pub fn binding_pattern_kind_from_object_pattern(self, inner: T) -> BindingPatternKind<'a> - where - T: IntoIn<'a, Box<'a, ObjectPattern<'a>>>, - { - BindingPatternKind::ObjectPattern(inner.into_in(self.allocator)) - } - /// Build a [`BindingPatternKind::ArrayPattern`] /// /// This node contains an [`ArrayPattern`] that will be stored in the memory arena. @@ -5979,15 +5025,6 @@ impl<'a> AstBuilder<'a> { BindingPatternKind::ArrayPattern(self.alloc(self.array_pattern(span, elements, rest))) } - /// Convert an [`ArrayPattern`] into a [`BindingPatternKind::ArrayPattern`] - #[inline] - pub fn binding_pattern_kind_from_array_pattern(self, inner: T) -> BindingPatternKind<'a> - where - T: IntoIn<'a, Box<'a, ArrayPattern<'a>>>, - { - BindingPatternKind::ArrayPattern(inner.into_in(self.allocator)) - } - /// Build a [`BindingPatternKind::AssignmentPattern`] /// /// This node contains an [`AssignmentPattern`] that will be stored in the memory arena. @@ -6008,15 +5045,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`AssignmentPattern`] into a [`BindingPatternKind::AssignmentPattern`] - #[inline] - pub fn binding_pattern_kind_from_assignment_pattern(self, inner: T) -> BindingPatternKind<'a> - where - T: IntoIn<'a, Box<'a, AssignmentPattern<'a>>>, - { - BindingPatternKind::AssignmentPattern(inner.into_in(self.allocator)) - } - /// Build an [`AssignmentPattern`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_assignment_pattern`] instead. @@ -7041,15 +6069,6 @@ impl<'a> AstBuilder<'a> { ClassElement::StaticBlock(self.alloc(self.static_block(span, body))) } - /// Convert a [`StaticBlock`] into a [`ClassElement::StaticBlock`] - #[inline] - pub fn class_element_from_static_block(self, inner: T) -> ClassElement<'a> - where - T: IntoIn<'a, Box<'a, StaticBlock<'a>>>, - { - ClassElement::StaticBlock(inner.into_in(self.allocator)) - } - /// Build a [`ClassElement::MethodDefinition`] /// /// This node contains a [`MethodDefinition`] that will be stored in the memory arena. @@ -7099,15 +6118,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`MethodDefinition`] into a [`ClassElement::MethodDefinition`] - #[inline] - pub fn class_element_from_method_definition(self, inner: T) -> ClassElement<'a> - where - T: IntoIn<'a, Box<'a, MethodDefinition<'a>>>, - { - ClassElement::MethodDefinition(inner.into_in(self.allocator)) - } - /// Build a [`ClassElement::PropertyDefinition`] /// /// This node contains a [`PropertyDefinition`] that will be stored in the memory arena. @@ -7166,15 +6176,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`PropertyDefinition`] into a [`ClassElement::PropertyDefinition`] - #[inline] - pub fn class_element_from_property_definition(self, inner: T) -> ClassElement<'a> - where - T: IntoIn<'a, Box<'a, PropertyDefinition<'a>>>, - { - ClassElement::PropertyDefinition(inner.into_in(self.allocator)) - } - /// Build a [`ClassElement::AccessorProperty`] /// /// This node contains an [`AccessorProperty`] that will be stored in the memory arena. @@ -7221,15 +6222,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`AccessorProperty`] into a [`ClassElement::AccessorProperty`] - #[inline] - pub fn class_element_from_accessor_property(self, inner: T) -> ClassElement<'a> - where - T: IntoIn<'a, Box<'a, AccessorProperty<'a>>>, - { - ClassElement::AccessorProperty(inner.into_in(self.allocator)) - } - /// Build a [`ClassElement::TSIndexSignature`] /// /// This node contains a [`TSIndexSignature`] that will be stored in the memory arena. @@ -7261,15 +6253,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSIndexSignature`] into a [`ClassElement::TSIndexSignature`] - #[inline] - pub fn class_element_from_ts_index_signature(self, inner: T) -> ClassElement<'a> - where - T: IntoIn<'a, Box<'a, TSIndexSignature<'a>>>, - { - ClassElement::TSIndexSignature(inner.into_in(self.allocator)) - } - /// Build a [`MethodDefinition`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_method_definition`] instead. @@ -7615,15 +6598,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ImportDeclaration`] into a [`ModuleDeclaration::ImportDeclaration`] - #[inline] - pub fn module_declaration_from_import_declaration(self, inner: T) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, ImportDeclaration<'a>>>, - { - ModuleDeclaration::ImportDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`ModuleDeclaration::ExportAllDeclaration`] /// /// This node contains an [`ExportAllDeclaration`] that will be stored in the memory arena. @@ -7655,18 +6629,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ExportAllDeclaration`] into a [`ModuleDeclaration::ExportAllDeclaration`] - #[inline] - pub fn module_declaration_from_export_all_declaration( - self, - inner: T, - ) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, ExportAllDeclaration<'a>>>, - { - ModuleDeclaration::ExportAllDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`ModuleDeclaration::ExportDefaultDeclaration`] /// /// This node contains an [`ExportDefaultDeclaration`] that will be stored in the memory arena. @@ -7689,18 +6651,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ExportDefaultDeclaration`] into a [`ModuleDeclaration::ExportDefaultDeclaration`] - #[inline] - pub fn module_declaration_from_export_default_declaration( - self, - inner: T, - ) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, ExportDefaultDeclaration<'a>>>, - { - ModuleDeclaration::ExportDefaultDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`ModuleDeclaration::ExportNamedDeclaration`] /// /// This node contains an [`ExportNamedDeclaration`] that will be stored in the memory arena. @@ -7735,18 +6685,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ExportNamedDeclaration`] into a [`ModuleDeclaration::ExportNamedDeclaration`] - #[inline] - pub fn module_declaration_from_export_named_declaration( - self, - inner: T, - ) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, ExportNamedDeclaration<'a>>>, - { - ModuleDeclaration::ExportNamedDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`ModuleDeclaration::TSExportAssignment`] /// /// This node contains a [`TSExportAssignment`] that will be stored in the memory arena. @@ -7765,15 +6703,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSExportAssignment`] into a [`ModuleDeclaration::TSExportAssignment`] - #[inline] - pub fn module_declaration_from_ts_export_assignment(self, inner: T) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, TSExportAssignment<'a>>>, - { - ModuleDeclaration::TSExportAssignment(inner.into_in(self.allocator)) - } - /// Build a [`ModuleDeclaration::TSNamespaceExportDeclaration`] /// /// This node contains a [`TSNamespaceExportDeclaration`] that will be stored in the memory arena. @@ -7792,18 +6721,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSNamespaceExportDeclaration`] into a [`ModuleDeclaration::TSNamespaceExportDeclaration`] - #[inline] - pub fn module_declaration_from_ts_namespace_export_declaration( - self, - inner: T, - ) -> ModuleDeclaration<'a> - where - T: IntoIn<'a, Box<'a, TSNamespaceExportDeclaration<'a>>>, - { - ModuleDeclaration::TSNamespaceExportDeclaration(inner.into_in(self.allocator)) - } - /// Build an [`AccessorProperty`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_accessor_property`] instead. @@ -8019,18 +6936,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert an [`ImportSpecifier`] into an [`ImportDeclarationSpecifier::ImportSpecifier`] - #[inline] - pub fn import_declaration_specifier_from_import_specifier( - self, - inner: T, - ) -> ImportDeclarationSpecifier<'a> - where - T: IntoIn<'a, Box<'a, ImportSpecifier<'a>>>, - { - ImportDeclarationSpecifier::ImportSpecifier(inner.into_in(self.allocator)) - } - /// Build an [`ImportDeclarationSpecifier::ImportDefaultSpecifier`] /// /// This node contains an [`ImportDefaultSpecifier`] that will be stored in the memory arena. @@ -8049,18 +6954,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`ImportDefaultSpecifier`] into an [`ImportDeclarationSpecifier::ImportDefaultSpecifier`] - #[inline] - pub fn import_declaration_specifier_from_import_default_specifier( - self, - inner: T, - ) -> ImportDeclarationSpecifier<'a> - where - T: IntoIn<'a, Box<'a, ImportDefaultSpecifier<'a>>>, - { - ImportDeclarationSpecifier::ImportDefaultSpecifier(inner.into_in(self.allocator)) - } - /// Build an [`ImportDeclarationSpecifier::ImportNamespaceSpecifier`] /// /// This node contains an [`ImportNamespaceSpecifier`] that will be stored in the memory arena. @@ -8079,18 +6972,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`ImportNamespaceSpecifier`] into an [`ImportDeclarationSpecifier::ImportNamespaceSpecifier`] - #[inline] - pub fn import_declaration_specifier_from_import_namespace_specifier( - self, - inner: T, - ) -> ImportDeclarationSpecifier<'a> - where - T: IntoIn<'a, Box<'a, ImportNamespaceSpecifier<'a>>>, - { - ImportDeclarationSpecifier::ImportNamespaceSpecifier(inner.into_in(self.allocator)) - } - /// Build an [`ImportSpecifier`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_import_specifier`] instead. @@ -8284,15 +7165,6 @@ impl<'a> AstBuilder<'a> { ImportAttributeKey::Identifier(self.identifier_name(span, name)) } - /// Convert an [`IdentifierName`] into an [`ImportAttributeKey::Identifier`] - #[inline] - pub fn import_attribute_key_from_identifier_name(self, inner: T) -> ImportAttributeKey<'a> - where - T: IntoIn<'a, IdentifierName<'a>>, - { - ImportAttributeKey::Identifier(inner.into_in(self.allocator)) - } - /// Build an [`ImportAttributeKey::StringLiteral`] /// /// ## Parameters @@ -8310,15 +7182,6 @@ impl<'a> AstBuilder<'a> { ImportAttributeKey::StringLiteral(self.string_literal(span, value)) } - /// Convert a [`StringLiteral`] into an [`ImportAttributeKey::StringLiteral`] - #[inline] - pub fn import_attribute_key_from_string_literal(self, inner: T) -> ImportAttributeKey<'a> - where - T: IntoIn<'a, StringLiteral<'a>>, - { - ImportAttributeKey::StringLiteral(inner.into_in(self.allocator)) - } - /// Build an [`ExportNamedDeclaration`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_export_named_declaration`] instead. @@ -8578,18 +7441,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Function`] into an [`ExportDefaultDeclarationKind::FunctionDeclaration`] - #[inline] - pub fn export_default_declaration_kind_from_function( - self, - inner: T, - ) -> ExportDefaultDeclarationKind<'a> - where - T: IntoIn<'a, Box<'a, Function<'a>>>, - { - ExportDefaultDeclarationKind::FunctionDeclaration(inner.into_in(self.allocator)) - } - /// Build an [`ExportDefaultDeclarationKind::ClassDeclaration`] /// /// This node contains a [`Class`] that will be stored in the memory arena. @@ -8641,18 +7492,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`Class`] into an [`ExportDefaultDeclarationKind::ClassDeclaration`] - #[inline] - pub fn export_default_declaration_kind_from_class( - self, - inner: T, - ) -> ExportDefaultDeclarationKind<'a> - where - T: IntoIn<'a, Box<'a, Class<'a>>>, - { - ExportDefaultDeclarationKind::ClassDeclaration(inner.into_in(self.allocator)) - } - /// Build an [`ExportDefaultDeclarationKind::TSInterfaceDeclaration`] /// /// This node contains a [`TSInterfaceDeclaration`] that will be stored in the memory arena. @@ -8683,27 +7522,6 @@ impl<'a> AstBuilder<'a> { )) } - /// Convert a [`TSInterfaceDeclaration`] into an [`ExportDefaultDeclarationKind::TSInterfaceDeclaration`] - #[inline] - pub fn export_default_declaration_kind_from_ts_interface_declaration( - self, - inner: T, - ) -> ExportDefaultDeclarationKind<'a> - where - T: IntoIn<'a, Box<'a, TSInterfaceDeclaration<'a>>>, - { - ExportDefaultDeclarationKind::TSInterfaceDeclaration(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`ExportDefaultDeclarationKind`] without copying or re-allocating memory. - #[inline] - pub fn export_default_declaration_kind_expression( - self, - inner: Expression<'a>, - ) -> ExportDefaultDeclarationKind<'a> { - ExportDefaultDeclarationKind::from(inner) - } - /// Build a [`ModuleExportName::IdentifierName`] /// /// ## Parameters @@ -8717,15 +7535,6 @@ impl<'a> AstBuilder<'a> { ModuleExportName::IdentifierName(self.identifier_name(span, name)) } - /// Convert an [`IdentifierName`] into a [`ModuleExportName::IdentifierName`] - #[inline] - pub fn module_export_name_from_identifier_name(self, inner: T) -> ModuleExportName<'a> - where - T: IntoIn<'a, IdentifierName<'a>>, - { - ModuleExportName::IdentifierName(inner.into_in(self.allocator)) - } - /// Build a [`ModuleExportName::IdentifierReference`] /// /// ## Parameters @@ -8743,15 +7552,6 @@ impl<'a> AstBuilder<'a> { ModuleExportName::IdentifierReference(self.identifier_reference(span, name)) } - /// Convert an [`IdentifierReference`] into a [`ModuleExportName::IdentifierReference`] - #[inline] - pub fn module_export_name_from_identifier_reference(self, inner: T) -> ModuleExportName<'a> - where - T: IntoIn<'a, IdentifierReference<'a>>, - { - ModuleExportName::IdentifierReference(inner.into_in(self.allocator)) - } - /// Build a [`ModuleExportName::StringLiteral`] /// /// ## Parameters @@ -8765,15 +7565,6 @@ impl<'a> AstBuilder<'a> { ModuleExportName::StringLiteral(self.string_literal(span, value)) } - /// Convert a [`StringLiteral`] into a [`ModuleExportName::StringLiteral`] - #[inline] - pub fn module_export_name_from_string_literal(self, inner: T) -> ModuleExportName<'a> - where - T: IntoIn<'a, StringLiteral<'a>>, - { - ModuleExportName::StringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSThisParameter`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_this_parameter`] instead. @@ -8973,15 +7764,6 @@ impl<'a> AstBuilder<'a> { TSEnumMemberName::StaticIdentifier(self.alloc(self.identifier_name(span, name))) } - /// Convert an [`IdentifierName`] into a [`TSEnumMemberName::StaticIdentifier`] - #[inline] - pub fn ts_enum_member_name_from_identifier_name(self, inner: T) -> TSEnumMemberName<'a> - where - T: IntoIn<'a, Box<'a, IdentifierName<'a>>>, - { - TSEnumMemberName::StaticIdentifier(inner.into_in(self.allocator)) - } - /// Build a [`TSEnumMemberName::StaticStringLiteral`] /// /// This node contains a [`StringLiteral`] that will be stored in the memory arena. @@ -8997,15 +7779,6 @@ impl<'a> AstBuilder<'a> { TSEnumMemberName::StaticStringLiteral(self.alloc(self.string_literal(span, value))) } - /// Convert a [`StringLiteral`] into a [`TSEnumMemberName::StaticStringLiteral`] - #[inline] - pub fn ts_enum_member_name_from_string_literal(self, inner: T) -> TSEnumMemberName<'a> - where - T: IntoIn<'a, Box<'a, StringLiteral<'a>>>, - { - TSEnumMemberName::StaticStringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSEnumMemberName::StaticTemplateLiteral`] /// /// This node contains a [`TemplateLiteral`] that will be stored in the memory arena. @@ -9028,15 +7801,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TemplateLiteral`] into a [`TSEnumMemberName::StaticTemplateLiteral`] - #[inline] - pub fn ts_enum_member_name_from_template_literal(self, inner: T) -> TSEnumMemberName<'a> - where - T: IntoIn<'a, Box<'a, TemplateLiteral<'a>>>, - { - TSEnumMemberName::StaticTemplateLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSEnumMemberName::StaticNumericLiteral`] /// /// This node contains a [`NumericLiteral`] that will be stored in the memory arena. @@ -9062,21 +7826,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`NumericLiteral`] into a [`TSEnumMemberName::StaticNumericLiteral`] - #[inline] - pub fn ts_enum_member_name_from_numeric_literal(self, inner: T) -> TSEnumMemberName<'a> - where - T: IntoIn<'a, Box<'a, NumericLiteral<'a>>>, - { - TSEnumMemberName::StaticNumericLiteral(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`TSEnumMemberName`] without copying or re-allocating memory. - #[inline] - pub fn ts_enum_member_name_expression(self, inner: Expression<'a>) -> TSEnumMemberName<'a> { - TSEnumMemberName::from(inner) - } - /// Build a [`TSTypeAnnotation`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_type_annotation`] instead. @@ -9149,15 +7898,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::BooleanLiteral(self.alloc(self.boolean_literal(span, value))) } - /// Convert a [`BooleanLiteral`] into a [`TSLiteral::BooleanLiteral`] - #[inline] - pub fn ts_literal_from_boolean_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, BooleanLiteral>>, - { - TSLiteral::BooleanLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::NullLiteral`] /// /// This node contains a [`NullLiteral`] that will be stored in the memory arena. @@ -9169,15 +7909,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::NullLiteral(self.alloc(self.null_literal(span))) } - /// Convert a [`NullLiteral`] into a [`TSLiteral::NullLiteral`] - #[inline] - pub fn ts_literal_from_null_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, NullLiteral>>, - { - TSLiteral::NullLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::NumericLiteral`] /// /// This node contains a [`NumericLiteral`] that will be stored in the memory arena. @@ -9201,15 +7932,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::NumericLiteral(self.alloc(self.numeric_literal(span, value, raw, base))) } - /// Convert a [`NumericLiteral`] into a [`TSLiteral::NumericLiteral`] - #[inline] - pub fn ts_literal_from_numeric_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, NumericLiteral<'a>>>, - { - TSLiteral::NumericLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::BigIntLiteral`] /// /// This node contains a [`BigIntLiteral`] that will be stored in the memory arena. @@ -9231,15 +7953,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::BigIntLiteral(self.alloc(self.big_int_literal(span, raw, base))) } - /// Convert a [`BigIntLiteral`] into a [`TSLiteral::BigIntLiteral`] - #[inline] - pub fn ts_literal_from_big_int_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, BigIntLiteral<'a>>>, - { - TSLiteral::BigIntLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::RegExpLiteral`] /// /// This node contains a [`RegExpLiteral`] that will be stored in the memory arena. @@ -9258,15 +7971,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::RegExpLiteral(self.alloc(self.reg_exp_literal(span, value, regex))) } - /// Convert a [`RegExpLiteral`] into a [`TSLiteral::RegExpLiteral`] - #[inline] - pub fn ts_literal_from_reg_exp_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, RegExpLiteral<'a>>>, - { - TSLiteral::RegExpLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::StringLiteral`] /// /// This node contains a [`StringLiteral`] that will be stored in the memory arena. @@ -9282,15 +7986,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::StringLiteral(self.alloc(self.string_literal(span, value))) } - /// Convert a [`StringLiteral`] into a [`TSLiteral::StringLiteral`] - #[inline] - pub fn ts_literal_from_string_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, StringLiteral<'a>>>, - { - TSLiteral::StringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::TemplateLiteral`] /// /// This node contains a [`TemplateLiteral`] that will be stored in the memory arena. @@ -9309,15 +8004,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::TemplateLiteral(self.alloc(self.template_literal(span, quasis, expressions))) } - /// Convert a [`TemplateLiteral`] into a [`TSLiteral::TemplateLiteral`] - #[inline] - pub fn ts_literal_from_template_literal(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, TemplateLiteral<'a>>>, - { - TSLiteral::TemplateLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSLiteral::UnaryExpression`] /// /// This node contains an [`UnaryExpression`] that will be stored in the memory arena. @@ -9336,15 +8022,6 @@ impl<'a> AstBuilder<'a> { TSLiteral::UnaryExpression(self.alloc(self.unary_expression(span, operator, argument))) } - /// Convert an [`UnaryExpression`] into a [`TSLiteral::UnaryExpression`] - #[inline] - pub fn ts_literal_from_unary_expression(self, inner: T) -> TSLiteral<'a> - where - T: IntoIn<'a, Box<'a, UnaryExpression<'a>>>, - { - TSLiteral::UnaryExpression(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSAnyKeyword`] /// /// This node contains a [`TSAnyKeyword`] that will be stored in the memory arena. @@ -9356,15 +8033,6 @@ impl<'a> AstBuilder<'a> { TSType::TSAnyKeyword(self.alloc(self.ts_any_keyword(span))) } - /// Convert a [`TSAnyKeyword`] into a [`TSType::TSAnyKeyword`] - #[inline] - pub fn ts_type_from_ts_any_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSAnyKeyword>>, - { - TSType::TSAnyKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSBigIntKeyword`] /// /// This node contains a [`TSBigIntKeyword`] that will be stored in the memory arena. @@ -9376,15 +8044,6 @@ impl<'a> AstBuilder<'a> { TSType::TSBigIntKeyword(self.alloc(self.ts_big_int_keyword(span))) } - /// Convert a [`TSBigIntKeyword`] into a [`TSType::TSBigIntKeyword`] - #[inline] - pub fn ts_type_from_ts_big_int_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSBigIntKeyword>>, - { - TSType::TSBigIntKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSBooleanKeyword`] /// /// This node contains a [`TSBooleanKeyword`] that will be stored in the memory arena. @@ -9396,15 +8055,6 @@ impl<'a> AstBuilder<'a> { TSType::TSBooleanKeyword(self.alloc(self.ts_boolean_keyword(span))) } - /// Convert a [`TSBooleanKeyword`] into a [`TSType::TSBooleanKeyword`] - #[inline] - pub fn ts_type_from_ts_boolean_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSBooleanKeyword>>, - { - TSType::TSBooleanKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSIntrinsicKeyword`] /// /// This node contains a [`TSIntrinsicKeyword`] that will be stored in the memory arena. @@ -9416,15 +8066,6 @@ impl<'a> AstBuilder<'a> { TSType::TSIntrinsicKeyword(self.alloc(self.ts_intrinsic_keyword(span))) } - /// Convert a [`TSIntrinsicKeyword`] into a [`TSType::TSIntrinsicKeyword`] - #[inline] - pub fn ts_type_from_ts_intrinsic_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSIntrinsicKeyword>>, - { - TSType::TSIntrinsicKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSNeverKeyword`] /// /// This node contains a [`TSNeverKeyword`] that will be stored in the memory arena. @@ -9436,15 +8077,6 @@ impl<'a> AstBuilder<'a> { TSType::TSNeverKeyword(self.alloc(self.ts_never_keyword(span))) } - /// Convert a [`TSNeverKeyword`] into a [`TSType::TSNeverKeyword`] - #[inline] - pub fn ts_type_from_ts_never_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSNeverKeyword>>, - { - TSType::TSNeverKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSNullKeyword`] /// /// This node contains a [`TSNullKeyword`] that will be stored in the memory arena. @@ -9456,15 +8088,6 @@ impl<'a> AstBuilder<'a> { TSType::TSNullKeyword(self.alloc(self.ts_null_keyword(span))) } - /// Convert a [`TSNullKeyword`] into a [`TSType::TSNullKeyword`] - #[inline] - pub fn ts_type_from_ts_null_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSNullKeyword>>, - { - TSType::TSNullKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSNumberKeyword`] /// /// This node contains a [`TSNumberKeyword`] that will be stored in the memory arena. @@ -9476,15 +8099,6 @@ impl<'a> AstBuilder<'a> { TSType::TSNumberKeyword(self.alloc(self.ts_number_keyword(span))) } - /// Convert a [`TSNumberKeyword`] into a [`TSType::TSNumberKeyword`] - #[inline] - pub fn ts_type_from_ts_number_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSNumberKeyword>>, - { - TSType::TSNumberKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSObjectKeyword`] /// /// This node contains a [`TSObjectKeyword`] that will be stored in the memory arena. @@ -9496,15 +8110,6 @@ impl<'a> AstBuilder<'a> { TSType::TSObjectKeyword(self.alloc(self.ts_object_keyword(span))) } - /// Convert a [`TSObjectKeyword`] into a [`TSType::TSObjectKeyword`] - #[inline] - pub fn ts_type_from_ts_object_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSObjectKeyword>>, - { - TSType::TSObjectKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSStringKeyword`] /// /// This node contains a [`TSStringKeyword`] that will be stored in the memory arena. @@ -9516,15 +8121,6 @@ impl<'a> AstBuilder<'a> { TSType::TSStringKeyword(self.alloc(self.ts_string_keyword(span))) } - /// Convert a [`TSStringKeyword`] into a [`TSType::TSStringKeyword`] - #[inline] - pub fn ts_type_from_ts_string_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSStringKeyword>>, - { - TSType::TSStringKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSSymbolKeyword`] /// /// This node contains a [`TSSymbolKeyword`] that will be stored in the memory arena. @@ -9536,15 +8132,6 @@ impl<'a> AstBuilder<'a> { TSType::TSSymbolKeyword(self.alloc(self.ts_symbol_keyword(span))) } - /// Convert a [`TSSymbolKeyword`] into a [`TSType::TSSymbolKeyword`] - #[inline] - pub fn ts_type_from_ts_symbol_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSSymbolKeyword>>, - { - TSType::TSSymbolKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSUndefinedKeyword`] /// /// This node contains a [`TSUndefinedKeyword`] that will be stored in the memory arena. @@ -9556,15 +8143,6 @@ impl<'a> AstBuilder<'a> { TSType::TSUndefinedKeyword(self.alloc(self.ts_undefined_keyword(span))) } - /// Convert a [`TSUndefinedKeyword`] into a [`TSType::TSUndefinedKeyword`] - #[inline] - pub fn ts_type_from_ts_undefined_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSUndefinedKeyword>>, - { - TSType::TSUndefinedKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSUnknownKeyword`] /// /// This node contains a [`TSUnknownKeyword`] that will be stored in the memory arena. @@ -9576,15 +8154,6 @@ impl<'a> AstBuilder<'a> { TSType::TSUnknownKeyword(self.alloc(self.ts_unknown_keyword(span))) } - /// Convert a [`TSUnknownKeyword`] into a [`TSType::TSUnknownKeyword`] - #[inline] - pub fn ts_type_from_ts_unknown_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSUnknownKeyword>>, - { - TSType::TSUnknownKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSVoidKeyword`] /// /// This node contains a [`TSVoidKeyword`] that will be stored in the memory arena. @@ -9596,15 +8165,6 @@ impl<'a> AstBuilder<'a> { TSType::TSVoidKeyword(self.alloc(self.ts_void_keyword(span))) } - /// Convert a [`TSVoidKeyword`] into a [`TSType::TSVoidKeyword`] - #[inline] - pub fn ts_type_from_ts_void_keyword(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSVoidKeyword>>, - { - TSType::TSVoidKeyword(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSArrayType`] /// /// This node contains a [`TSArrayType`] that will be stored in the memory arena. @@ -9617,15 +8177,6 @@ impl<'a> AstBuilder<'a> { TSType::TSArrayType(self.alloc(self.ts_array_type(span, element_type))) } - /// Convert a [`TSArrayType`] into a [`TSType::TSArrayType`] - #[inline] - pub fn ts_type_from_ts_array_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSArrayType<'a>>>, - { - TSType::TSArrayType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSConditionalType`] /// /// This node contains a [`TSConditionalType`] that will be stored in the memory arena. @@ -9654,15 +8205,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSConditionalType`] into a [`TSType::TSConditionalType`] - #[inline] - pub fn ts_type_from_ts_conditional_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSConditionalType<'a>>>, - { - TSType::TSConditionalType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSConstructorType`] /// /// This node contains a [`TSConstructorType`] that will be stored in the memory arena. @@ -9696,15 +8238,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSConstructorType`] into a [`TSType::TSConstructorType`] - #[inline] - pub fn ts_type_from_ts_constructor_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSConstructorType<'a>>>, - { - TSType::TSConstructorType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSFunctionType`] /// /// This node contains a [`TSFunctionType`] that will be stored in the memory arena. @@ -9739,15 +8272,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSFunctionType`] into a [`TSType::TSFunctionType`] - #[inline] - pub fn ts_type_from_ts_function_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSFunctionType<'a>>>, - { - TSType::TSFunctionType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSImportType`] /// /// This node contains a [`TSImportType`] that will be stored in the memory arena. @@ -9783,15 +8307,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSImportType`] into a [`TSType::TSImportType`] - #[inline] - pub fn ts_type_from_ts_import_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSImportType<'a>>>, - { - TSType::TSImportType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSIndexedAccessType`] /// /// This node contains a [`TSIndexedAccessType`] that will be stored in the memory arena. @@ -9814,15 +8329,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSIndexedAccessType`] into a [`TSType::TSIndexedAccessType`] - #[inline] - pub fn ts_type_from_ts_indexed_access_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSIndexedAccessType<'a>>>, - { - TSType::TSIndexedAccessType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSInferType`] /// /// This node contains a [`TSInferType`] that will be stored in the memory arena. @@ -9838,15 +8344,6 @@ impl<'a> AstBuilder<'a> { TSType::TSInferType(self.alloc(self.ts_infer_type(span, type_parameter))) } - /// Convert a [`TSInferType`] into a [`TSType::TSInferType`] - #[inline] - pub fn ts_type_from_ts_infer_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSInferType<'a>>>, - { - TSType::TSInferType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSIntersectionType`] /// /// This node contains a [`TSIntersectionType`] that will be stored in the memory arena. @@ -9859,15 +8356,6 @@ impl<'a> AstBuilder<'a> { TSType::TSIntersectionType(self.alloc(self.ts_intersection_type(span, types))) } - /// Convert a [`TSIntersectionType`] into a [`TSType::TSIntersectionType`] - #[inline] - pub fn ts_type_from_ts_intersection_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSIntersectionType<'a>>>, - { - TSType::TSIntersectionType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSLiteralType`] /// /// This node contains a [`TSLiteralType`] that will be stored in the memory arena. @@ -9880,15 +8368,6 @@ impl<'a> AstBuilder<'a> { TSType::TSLiteralType(self.alloc(self.ts_literal_type(span, literal))) } - /// Convert a [`TSLiteralType`] into a [`TSType::TSLiteralType`] - #[inline] - pub fn ts_type_from_ts_literal_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSLiteralType<'a>>>, - { - TSType::TSLiteralType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSMappedType`] /// /// This node contains a [`TSMappedType`] that will be stored in the memory arena. @@ -9923,15 +8402,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSMappedType`] into a [`TSType::TSMappedType`] - #[inline] - pub fn ts_type_from_ts_mapped_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSMappedType<'a>>>, - { - TSType::TSMappedType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSNamedTupleMember`] /// /// This node contains a [`TSNamedTupleMember`] that will be stored in the memory arena. @@ -9957,15 +8427,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSNamedTupleMember`] into a [`TSType::TSNamedTupleMember`] - #[inline] - pub fn ts_type_from_ts_named_tuple_member(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSNamedTupleMember<'a>>>, - { - TSType::TSNamedTupleMember(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSQualifiedName`] /// /// This node contains a [`TSQualifiedName`] that will be stored in the memory arena. @@ -9984,15 +8445,6 @@ impl<'a> AstBuilder<'a> { TSType::TSQualifiedName(self.alloc(self.ts_qualified_name(span, left, right))) } - /// Convert a [`TSQualifiedName`] into a [`TSType::TSQualifiedName`] - #[inline] - pub fn ts_type_from_ts_qualified_name(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSQualifiedName<'a>>>, - { - TSType::TSQualifiedName(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTemplateLiteralType`] /// /// This node contains a [`TSTemplateLiteralType`] that will be stored in the memory arena. @@ -10013,15 +8465,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSTemplateLiteralType`] into a [`TSType::TSTemplateLiteralType`] - #[inline] - pub fn ts_type_from_ts_template_literal_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTemplateLiteralType<'a>>>, - { - TSType::TSTemplateLiteralType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSThisType`] /// /// This node contains a [`TSThisType`] that will be stored in the memory arena. @@ -10033,15 +8476,6 @@ impl<'a> AstBuilder<'a> { TSType::TSThisType(self.alloc(self.ts_this_type(span))) } - /// Convert a [`TSThisType`] into a [`TSType::TSThisType`] - #[inline] - pub fn ts_type_from_ts_this_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSThisType>>, - { - TSType::TSThisType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTupleType`] /// /// This node contains a [`TSTupleType`] that will be stored in the memory arena. @@ -10058,15 +8492,6 @@ impl<'a> AstBuilder<'a> { TSType::TSTupleType(self.alloc(self.ts_tuple_type(span, element_types))) } - /// Convert a [`TSTupleType`] into a [`TSType::TSTupleType`] - #[inline] - pub fn ts_type_from_ts_tuple_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTupleType<'a>>>, - { - TSType::TSTupleType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTypeLiteral`] /// /// This node contains a [`TSTypeLiteral`] that will be stored in the memory arena. @@ -10079,15 +8504,6 @@ impl<'a> AstBuilder<'a> { TSType::TSTypeLiteral(self.alloc(self.ts_type_literal(span, members))) } - /// Convert a [`TSTypeLiteral`] into a [`TSType::TSTypeLiteral`] - #[inline] - pub fn ts_type_from_ts_type_literal(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTypeLiteral<'a>>>, - { - TSType::TSTypeLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTypeOperatorType`] /// /// This node contains a [`TSTypeOperator`] that will be stored in the memory arena. @@ -10110,15 +8526,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypeOperator`] into a [`TSType::TSTypeOperatorType`] - #[inline] - pub fn ts_type_from_ts_type_operator(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTypeOperator<'a>>>, - { - TSType::TSTypeOperatorType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTypePredicate`] /// /// This node contains a [`TSTypePredicate`] that will be stored in the memory arena. @@ -10147,15 +8554,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypePredicate`] into a [`TSType::TSTypePredicate`] - #[inline] - pub fn ts_type_from_ts_type_predicate(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTypePredicate<'a>>>, - { - TSType::TSTypePredicate(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTypeQuery`] /// /// This node contains a [`TSTypeQuery`] that will be stored in the memory arena. @@ -10177,15 +8575,6 @@ impl<'a> AstBuilder<'a> { TSType::TSTypeQuery(self.alloc(self.ts_type_query(span, expr_name, type_parameters))) } - /// Convert a [`TSTypeQuery`] into a [`TSType::TSTypeQuery`] - #[inline] - pub fn ts_type_from_ts_type_query(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTypeQuery<'a>>>, - { - TSType::TSTypeQuery(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSTypeReference`] /// /// This node contains a [`TSTypeReference`] that will be stored in the memory arena. @@ -10211,15 +8600,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSTypeReference`] into a [`TSType::TSTypeReference`] - #[inline] - pub fn ts_type_from_ts_type_reference(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSTypeReference<'a>>>, - { - TSType::TSTypeReference(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSUnionType`] /// /// This node contains a [`TSUnionType`] that will be stored in the memory arena. @@ -10232,15 +8612,6 @@ impl<'a> AstBuilder<'a> { TSType::TSUnionType(self.alloc(self.ts_union_type(span, types))) } - /// Convert a [`TSUnionType`] into a [`TSType::TSUnionType`] - #[inline] - pub fn ts_type_from_ts_union_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSUnionType<'a>>>, - { - TSType::TSUnionType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::TSParenthesizedType`] /// /// This node contains a [`TSParenthesizedType`] that will be stored in the memory arena. @@ -10249,17 +8620,8 @@ impl<'a> AstBuilder<'a> { /// - span: The [`Span`] covering this node /// - type_annotation #[inline] - pub fn ts_type_parenthesized_type(self, span: Span, type_annotation: TSType<'a>) -> TSType<'a> { - TSType::TSParenthesizedType(self.alloc(self.ts_parenthesized_type(span, type_annotation))) - } - - /// Convert a [`TSParenthesizedType`] into a [`TSType::TSParenthesizedType`] - #[inline] - pub fn ts_type_from_ts_parenthesized_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, TSParenthesizedType<'a>>>, - { - TSType::TSParenthesizedType(inner.into_in(self.allocator)) + pub fn ts_type_parenthesized_type(self, span: Span, type_annotation: TSType<'a>) -> TSType<'a> { + TSType::TSParenthesizedType(self.alloc(self.ts_parenthesized_type(span, type_annotation))) } /// Build a [`TSType::JSDocNullableType`] @@ -10284,15 +8646,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSDocNullableType`] into a [`TSType::JSDocNullableType`] - #[inline] - pub fn ts_type_from_js_doc_nullable_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, JSDocNullableType<'a>>>, - { - TSType::JSDocNullableType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::JSDocNonNullableType`] /// /// This node contains a [`JSDocNonNullableType`] that will be stored in the memory arena. @@ -10315,15 +8668,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSDocNonNullableType`] into a [`TSType::JSDocNonNullableType`] - #[inline] - pub fn ts_type_from_js_doc_non_nullable_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, JSDocNonNullableType<'a>>>, - { - TSType::JSDocNonNullableType(inner.into_in(self.allocator)) - } - /// Build a [`TSType::JSDocUnknownType`] /// /// This node contains a [`JSDocUnknownType`] that will be stored in the memory arena. @@ -10335,15 +8679,6 @@ impl<'a> AstBuilder<'a> { TSType::JSDocUnknownType(self.alloc(self.js_doc_unknown_type(span))) } - /// Convert a [`JSDocUnknownType`] into a [`TSType::JSDocUnknownType`] - #[inline] - pub fn ts_type_from_js_doc_unknown_type(self, inner: T) -> TSType<'a> - where - T: IntoIn<'a, Box<'a, JSDocUnknownType>>, - { - TSType::JSDocUnknownType(inner.into_in(self.allocator)) - } - /// Build a [`TSConditionalType`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_conditional_type`] instead. @@ -10799,15 +9134,6 @@ impl<'a> AstBuilder<'a> { TSTupleElement::TSOptionalType(self.alloc(self.ts_optional_type(span, type_annotation))) } - /// Convert a [`TSOptionalType`] into a [`TSTupleElement::TSOptionalType`] - #[inline] - pub fn ts_tuple_element_from_ts_optional_type(self, inner: T) -> TSTupleElement<'a> - where - T: IntoIn<'a, Box<'a, TSOptionalType<'a>>>, - { - TSTupleElement::TSOptionalType(inner.into_in(self.allocator)) - } - /// Build a [`TSTupleElement::TSRestType`] /// /// This node contains a [`TSRestType`] that will be stored in the memory arena. @@ -10824,21 +9150,6 @@ impl<'a> AstBuilder<'a> { TSTupleElement::TSRestType(self.alloc(self.ts_rest_type(span, type_annotation))) } - /// Convert a [`TSRestType`] into a [`TSTupleElement::TSRestType`] - #[inline] - pub fn ts_tuple_element_from_ts_rest_type(self, inner: T) -> TSTupleElement<'a> - where - T: IntoIn<'a, Box<'a, TSRestType<'a>>>, - { - TSTupleElement::TSRestType(inner.into_in(self.allocator)) - } - - /// Convert a [`TSType`] into the corresponding variant of [`TSTupleElement`] without copying or re-allocating memory. - #[inline] - pub fn ts_tuple_element_type(self, inner: TSType<'a>) -> TSTupleElement<'a> { - TSTupleElement::from(inner) - } - /// Build a [`TSAnyKeyword`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_any_keyword`] instead. @@ -11208,15 +9519,6 @@ impl<'a> AstBuilder<'a> { TSTypeName::IdentifierReference(self.alloc(self.identifier_reference(span, name))) } - /// Convert an [`IdentifierReference`] into a [`TSTypeName::IdentifierReference`] - #[inline] - pub fn ts_type_name_from_identifier_reference(self, inner: T) -> TSTypeName<'a> - where - T: IntoIn<'a, Box<'a, IdentifierReference<'a>>>, - { - TSTypeName::IdentifierReference(inner.into_in(self.allocator)) - } - /// Build a [`TSTypeName::QualifiedName`] /// /// This node contains a [`TSQualifiedName`] that will be stored in the memory arena. @@ -11235,15 +9537,6 @@ impl<'a> AstBuilder<'a> { TSTypeName::QualifiedName(self.alloc(self.ts_qualified_name(span, left, right))) } - /// Convert a [`TSQualifiedName`] into a [`TSTypeName::QualifiedName`] - #[inline] - pub fn ts_type_name_from_ts_qualified_name(self, inner: T) -> TSTypeName<'a> - where - T: IntoIn<'a, Box<'a, TSQualifiedName<'a>>>, - { - TSTypeName::QualifiedName(inner.into_in(self.allocator)) - } - /// Build a [`TSQualifiedName`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_qualified_name`] instead. @@ -11849,15 +10142,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSIndexSignature`] into a [`TSSignature::TSIndexSignature`] - #[inline] - pub fn ts_signature_from_ts_index_signature(self, inner: T) -> TSSignature<'a> - where - T: IntoIn<'a, Box<'a, TSIndexSignature<'a>>>, - { - TSSignature::TSIndexSignature(inner.into_in(self.allocator)) - } - /// Build a [`TSSignature::TSPropertySignature`] /// /// This node contains a [`TSPropertySignature`] that will be stored in the memory arena. @@ -11892,15 +10176,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSPropertySignature`] into a [`TSSignature::TSPropertySignature`] - #[inline] - pub fn ts_signature_from_ts_property_signature(self, inner: T) -> TSSignature<'a> - where - T: IntoIn<'a, Box<'a, TSPropertySignature<'a>>>, - { - TSSignature::TSPropertySignature(inner.into_in(self.allocator)) - } - /// Build a [`TSSignature::TSCallSignatureDeclaration`] /// /// This node contains a [`TSCallSignatureDeclaration`] that will be stored in the memory arena. @@ -11934,15 +10209,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSCallSignatureDeclaration`] into a [`TSSignature::TSCallSignatureDeclaration`] - #[inline] - pub fn ts_signature_from_ts_call_signature_declaration(self, inner: T) -> TSSignature<'a> - where - T: IntoIn<'a, Box<'a, TSCallSignatureDeclaration<'a>>>, - { - TSSignature::TSCallSignatureDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`TSSignature::TSConstructSignatureDeclaration`] /// /// This node contains a [`TSConstructSignatureDeclaration`] that will be stored in the memory arena. @@ -11970,18 +10236,6 @@ impl<'a> AstBuilder<'a> { )) } - /// Convert a [`TSConstructSignatureDeclaration`] into a [`TSSignature::TSConstructSignatureDeclaration`] - #[inline] - pub fn ts_signature_from_ts_construct_signature_declaration( - self, - inner: T, - ) -> TSSignature<'a> - where - T: IntoIn<'a, Box<'a, TSConstructSignatureDeclaration<'a>>>, - { - TSSignature::TSConstructSignatureDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`TSSignature::TSMethodSignature`] /// /// This node contains a [`TSMethodSignature`] that will be stored in the memory arena. @@ -12028,15 +10282,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSMethodSignature`] into a [`TSSignature::TSMethodSignature`] - #[inline] - pub fn ts_signature_from_ts_method_signature(self, inner: T) -> TSSignature<'a> - where - T: IntoIn<'a, Box<'a, TSMethodSignature<'a>>>, - { - TSSignature::TSMethodSignature(inner.into_in(self.allocator)) - } - /// Build a [`TSIndexSignature`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_index_signature`] instead. @@ -12657,15 +10902,6 @@ impl<'a> AstBuilder<'a> { TSTypePredicateName::Identifier(self.alloc(self.identifier_name(span, name))) } - /// Convert an [`IdentifierName`] into a [`TSTypePredicateName::Identifier`] - #[inline] - pub fn ts_type_predicate_name_from_identifier_name(self, inner: T) -> TSTypePredicateName<'a> - where - T: IntoIn<'a, Box<'a, IdentifierName<'a>>>, - { - TSTypePredicateName::Identifier(inner.into_in(self.allocator)) - } - /// Build a [`TSTypePredicateName::This`] /// /// ## Parameters @@ -12675,15 +10911,6 @@ impl<'a> AstBuilder<'a> { TSTypePredicateName::This(self.ts_this_type(span)) } - /// Convert a [`TSThisType`] into a [`TSTypePredicateName::This`] - #[inline] - pub fn ts_type_predicate_name_from_ts_this_type(self, inner: T) -> TSTypePredicateName<'a> - where - T: IntoIn<'a, TSThisType>, - { - TSTypePredicateName::This(inner.into_in(self.allocator)) - } - /// Build a [`TSModuleDeclaration`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_module_declaration`] instead. @@ -12796,18 +11023,6 @@ impl<'a> AstBuilder<'a> { TSModuleDeclarationName::Identifier(self.binding_identifier(span, name)) } - /// Convert a [`BindingIdentifier`] into a [`TSModuleDeclarationName::Identifier`] - #[inline] - pub fn ts_module_declaration_name_from_binding_identifier( - self, - inner: T, - ) -> TSModuleDeclarationName<'a> - where - T: IntoIn<'a, BindingIdentifier<'a>>, - { - TSModuleDeclarationName::Identifier(inner.into_in(self.allocator)) - } - /// Build a [`TSModuleDeclarationName::StringLiteral`] /// /// ## Parameters @@ -12825,18 +11040,6 @@ impl<'a> AstBuilder<'a> { TSModuleDeclarationName::StringLiteral(self.string_literal(span, value)) } - /// Convert a [`StringLiteral`] into a [`TSModuleDeclarationName::StringLiteral`] - #[inline] - pub fn ts_module_declaration_name_from_string_literal( - self, - inner: T, - ) -> TSModuleDeclarationName<'a> - where - T: IntoIn<'a, StringLiteral<'a>>, - { - TSModuleDeclarationName::StringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSModuleDeclarationBody::TSModuleDeclaration`] /// /// This node contains a [`TSModuleDeclaration`] that will be stored in the memory arena. @@ -12861,18 +11064,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSModuleDeclaration`] into a [`TSModuleDeclarationBody::TSModuleDeclaration`] - #[inline] - pub fn ts_module_declaration_body_from_ts_module_declaration( - self, - inner: T, - ) -> TSModuleDeclarationBody<'a> - where - T: IntoIn<'a, Box<'a, TSModuleDeclaration<'a>>>, - { - TSModuleDeclarationBody::TSModuleDeclaration(inner.into_in(self.allocator)) - } - /// Build a [`TSModuleDeclarationBody::TSModuleBlock`] /// /// This node contains a [`TSModuleBlock`] that will be stored in the memory arena. @@ -12893,18 +11084,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSModuleBlock`] into a [`TSModuleDeclarationBody::TSModuleBlock`] - #[inline] - pub fn ts_module_declaration_body_from_ts_module_block( - self, - inner: T, - ) -> TSModuleDeclarationBody<'a> - where - T: IntoIn<'a, Box<'a, TSModuleBlock<'a>>>, - { - TSModuleDeclarationBody::TSModuleBlock(inner.into_in(self.allocator)) - } - /// Build a [`TSModuleBlock`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_module_block`] instead. @@ -13080,24 +11259,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`TSImportType`] into a [`TSTypeQueryExprName::TSImportType`] - #[inline] - pub fn ts_type_query_expr_name_from_ts_import_type(self, inner: T) -> TSTypeQueryExprName<'a> - where - T: IntoIn<'a, Box<'a, TSImportType<'a>>>, - { - TSTypeQueryExprName::TSImportType(inner.into_in(self.allocator)) - } - - /// Convert a [`TSTypeName`] into the corresponding variant of [`TSTypeQueryExprName`] without copying or re-allocating memory. - #[inline] - pub fn ts_type_query_expr_name_type_name( - self, - inner: TSTypeName<'a>, - ) -> TSTypeQueryExprName<'a> { - TSTypeQueryExprName::from(inner) - } - /// Build a [`TSImportType`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_import_type`] instead. @@ -13260,18 +11421,6 @@ impl<'a> AstBuilder<'a> { TSImportAttributeName::Identifier(self.identifier_name(span, name)) } - /// Convert an [`IdentifierName`] into a [`TSImportAttributeName::Identifier`] - #[inline] - pub fn ts_import_attribute_name_from_identifier_name( - self, - inner: T, - ) -> TSImportAttributeName<'a> - where - T: IntoIn<'a, IdentifierName<'a>>, - { - TSImportAttributeName::Identifier(inner.into_in(self.allocator)) - } - /// Build a [`TSImportAttributeName::StringLiteral`] /// /// ## Parameters @@ -13289,18 +11438,6 @@ impl<'a> AstBuilder<'a> { TSImportAttributeName::StringLiteral(self.string_literal(span, value)) } - /// Convert a [`StringLiteral`] into a [`TSImportAttributeName::StringLiteral`] - #[inline] - pub fn ts_import_attribute_name_from_string_literal( - self, - inner: T, - ) -> TSImportAttributeName<'a> - where - T: IntoIn<'a, StringLiteral<'a>>, - { - TSImportAttributeName::StringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`TSFunctionType`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_function_type`] instead. @@ -13783,24 +11920,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`TSExternalModuleReference`] into a [`TSModuleReference::ExternalModuleReference`] - #[inline] - pub fn ts_module_reference_from_ts_external_module_reference( - self, - inner: T, - ) -> TSModuleReference<'a> - where - T: IntoIn<'a, Box<'a, TSExternalModuleReference<'a>>>, - { - TSModuleReference::ExternalModuleReference(inner.into_in(self.allocator)) - } - - /// Convert a [`TSTypeName`] into the corresponding variant of [`TSModuleReference`] without copying or re-allocating memory. - #[inline] - pub fn ts_module_reference_type_name(self, inner: TSTypeName<'a>) -> TSModuleReference<'a> { - TSModuleReference::from(inner) - } - /// Build a [`TSExternalModuleReference`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_ts_external_module_reference`] instead. @@ -14301,15 +12420,6 @@ impl<'a> AstBuilder<'a> { JSXElementName::Identifier(self.alloc(self.jsx_identifier(span, name))) } - /// Convert a [`JSXIdentifier`] into a [`JSXElementName::Identifier`] - #[inline] - pub fn jsx_element_name_from_jsx_identifier(self, inner: T) -> JSXElementName<'a> - where - T: IntoIn<'a, Box<'a, JSXIdentifier<'a>>>, - { - JSXElementName::Identifier(inner.into_in(self.allocator)) - } - /// Build a [`JSXElementName::IdentifierReference`] /// /// This node contains an [`IdentifierReference`] that will be stored in the memory arena. @@ -14325,15 +12435,6 @@ impl<'a> AstBuilder<'a> { JSXElementName::IdentifierReference(self.alloc(self.identifier_reference(span, name))) } - /// Convert an [`IdentifierReference`] into a [`JSXElementName::IdentifierReference`] - #[inline] - pub fn jsx_element_name_from_identifier_reference(self, inner: T) -> JSXElementName<'a> - where - T: IntoIn<'a, Box<'a, IdentifierReference<'a>>>, - { - JSXElementName::IdentifierReference(inner.into_in(self.allocator)) - } - /// Build a [`JSXElementName::NamespacedName`] /// /// This node contains a [`JSXNamespacedName`] that will be stored in the memory arena. @@ -14354,15 +12455,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`JSXNamespacedName`] into a [`JSXElementName::NamespacedName`] - #[inline] - pub fn jsx_element_name_from_jsx_namespaced_name(self, inner: T) -> JSXElementName<'a> - where - T: IntoIn<'a, Box<'a, JSXNamespacedName<'a>>>, - { - JSXElementName::NamespacedName(inner.into_in(self.allocator)) - } - /// Build a [`JSXElementName::MemberExpression`] /// /// This node contains a [`JSXMemberExpression`] that will be stored in the memory arena. @@ -14383,15 +12475,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`JSXMemberExpression`] into a [`JSXElementName::MemberExpression`] - #[inline] - pub fn jsx_element_name_from_jsx_member_expression(self, inner: T) -> JSXElementName<'a> - where - T: IntoIn<'a, Box<'a, JSXMemberExpression<'a>>>, - { - JSXElementName::MemberExpression(inner.into_in(self.allocator)) - } - /// Build a [`JSXElementName::ThisExpression`] /// /// This node contains a [`ThisExpression`] that will be stored in the memory arena. @@ -14403,15 +12486,6 @@ impl<'a> AstBuilder<'a> { JSXElementName::ThisExpression(self.alloc(self.this_expression(span))) } - /// Convert a [`ThisExpression`] into a [`JSXElementName::ThisExpression`] - #[inline] - pub fn jsx_element_name_from_this_expression(self, inner: T) -> JSXElementName<'a> - where - T: IntoIn<'a, Box<'a, ThisExpression>>, - { - JSXElementName::ThisExpression(inner.into_in(self.allocator)) - } - /// Build a [`JSXNamespacedName`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_namespaced_name`] instead. @@ -14505,18 +12579,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert an [`IdentifierReference`] into a [`JSXMemberExpressionObject::IdentifierReference`] - #[inline] - pub fn jsx_member_expression_object_from_identifier_reference( - self, - inner: T, - ) -> JSXMemberExpressionObject<'a> - where - T: IntoIn<'a, Box<'a, IdentifierReference<'a>>>, - { - JSXMemberExpressionObject::IdentifierReference(inner.into_in(self.allocator)) - } - /// Build a [`JSXMemberExpressionObject::MemberExpression`] /// /// This node contains a [`JSXMemberExpression`] that will be stored in the memory arena. @@ -14537,18 +12599,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`JSXMemberExpression`] into a [`JSXMemberExpressionObject::MemberExpression`] - #[inline] - pub fn jsx_member_expression_object_from_jsx_member_expression( - self, - inner: T, - ) -> JSXMemberExpressionObject<'a> - where - T: IntoIn<'a, Box<'a, JSXMemberExpression<'a>>>, - { - JSXMemberExpressionObject::MemberExpression(inner.into_in(self.allocator)) - } - /// Build a [`JSXMemberExpressionObject::ThisExpression`] /// /// This node contains a [`ThisExpression`] that will be stored in the memory arena. @@ -14563,18 +12613,6 @@ impl<'a> AstBuilder<'a> { JSXMemberExpressionObject::ThisExpression(self.alloc(self.this_expression(span))) } - /// Convert a [`ThisExpression`] into a [`JSXMemberExpressionObject::ThisExpression`] - #[inline] - pub fn jsx_member_expression_object_from_this_expression( - self, - inner: T, - ) -> JSXMemberExpressionObject<'a> - where - T: IntoIn<'a, Box<'a, ThisExpression>>, - { - JSXMemberExpressionObject::ThisExpression(inner.into_in(self.allocator)) - } - /// Build a [`JSXExpressionContainer`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_expression_container`] instead. @@ -14616,21 +12654,6 @@ impl<'a> AstBuilder<'a> { JSXExpression::EmptyExpression(self.jsx_empty_expression(span)) } - /// Convert a [`JSXEmptyExpression`] into a [`JSXExpression::EmptyExpression`] - #[inline] - pub fn jsx_expression_from_jsx_empty_expression(self, inner: T) -> JSXExpression<'a> - where - T: IntoIn<'a, JSXEmptyExpression>, - { - JSXExpression::EmptyExpression(inner.into_in(self.allocator)) - } - - /// Convert a [`Expression`] into the corresponding variant of [`JSXExpression`] without copying or re-allocating memory. - #[inline] - pub fn jsx_expression_expression(self, inner: Expression<'a>) -> JSXExpression<'a> { - JSXExpression::from(inner) - } - /// Build a [`JSXEmptyExpression`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_empty_expression`] instead. @@ -14671,15 +12694,6 @@ impl<'a> AstBuilder<'a> { JSXAttributeItem::Attribute(self.alloc(self.jsx_attribute(span, name, value))) } - /// Convert a [`JSXAttribute`] into a [`JSXAttributeItem::Attribute`] - #[inline] - pub fn jsx_attribute_item_from_jsx_attribute(self, inner: T) -> JSXAttributeItem<'a> - where - T: IntoIn<'a, Box<'a, JSXAttribute<'a>>>, - { - JSXAttributeItem::Attribute(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeItem::SpreadAttribute`] /// /// This node contains a [`JSXSpreadAttribute`] that will be stored in the memory arena. @@ -14696,15 +12710,6 @@ impl<'a> AstBuilder<'a> { JSXAttributeItem::SpreadAttribute(self.alloc(self.jsx_spread_attribute(span, argument))) } - /// Convert a [`JSXSpreadAttribute`] into a [`JSXAttributeItem::SpreadAttribute`] - #[inline] - pub fn jsx_attribute_item_from_jsx_spread_attribute(self, inner: T) -> JSXAttributeItem<'a> - where - T: IntoIn<'a, Box<'a, JSXSpreadAttribute<'a>>>, - { - JSXAttributeItem::SpreadAttribute(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttribute`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_attribute`] instead. @@ -14788,15 +12793,6 @@ impl<'a> AstBuilder<'a> { JSXAttributeName::Identifier(self.alloc(self.jsx_identifier(span, name))) } - /// Convert a [`JSXIdentifier`] into a [`JSXAttributeName::Identifier`] - #[inline] - pub fn jsx_attribute_name_from_jsx_identifier(self, inner: T) -> JSXAttributeName<'a> - where - T: IntoIn<'a, Box<'a, JSXIdentifier<'a>>>, - { - JSXAttributeName::Identifier(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeName::NamespacedName`] /// /// This node contains a [`JSXNamespacedName`] that will be stored in the memory arena. @@ -14817,15 +12813,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`JSXNamespacedName`] into a [`JSXAttributeName::NamespacedName`] - #[inline] - pub fn jsx_attribute_name_from_jsx_namespaced_name(self, inner: T) -> JSXAttributeName<'a> - where - T: IntoIn<'a, Box<'a, JSXNamespacedName<'a>>>, - { - JSXAttributeName::NamespacedName(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeValue::StringLiteral`] /// /// This node contains a [`StringLiteral`] that will be stored in the memory arena. @@ -14845,15 +12832,6 @@ impl<'a> AstBuilder<'a> { JSXAttributeValue::StringLiteral(self.alloc(self.string_literal(span, value))) } - /// Convert a [`StringLiteral`] into a [`JSXAttributeValue::StringLiteral`] - #[inline] - pub fn jsx_attribute_value_from_string_literal(self, inner: T) -> JSXAttributeValue<'a> - where - T: IntoIn<'a, Box<'a, StringLiteral<'a>>>, - { - JSXAttributeValue::StringLiteral(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeValue::ExpressionContainer`] /// /// This node contains a [`JSXExpressionContainer`] that will be stored in the memory arena. @@ -14872,18 +12850,6 @@ impl<'a> AstBuilder<'a> { ) } - /// Convert a [`JSXExpressionContainer`] into a [`JSXAttributeValue::ExpressionContainer`] - #[inline] - pub fn jsx_attribute_value_from_jsx_expression_container( - self, - inner: T, - ) -> JSXAttributeValue<'a> - where - T: IntoIn<'a, Box<'a, JSXExpressionContainer<'a>>>, - { - JSXAttributeValue::ExpressionContainer(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeValue::Element`] /// /// This node contains a [`JSXElement`] that will be stored in the memory arena. @@ -14913,15 +12879,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXElement`] into a [`JSXAttributeValue::Element`] - #[inline] - pub fn jsx_attribute_value_from_jsx_element(self, inner: T) -> JSXAttributeValue<'a> - where - T: IntoIn<'a, Box<'a, JSXElement<'a>>>, - { - JSXAttributeValue::Element(inner.into_in(self.allocator)) - } - /// Build a [`JSXAttributeValue::Fragment`] /// /// This node contains a [`JSXFragment`] that will be stored in the memory arena. @@ -14947,15 +12904,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXFragment`] into a [`JSXAttributeValue::Fragment`] - #[inline] - pub fn jsx_attribute_value_from_jsx_fragment(self, inner: T) -> JSXAttributeValue<'a> - where - T: IntoIn<'a, Box<'a, JSXFragment<'a>>>, - { - JSXAttributeValue::Fragment(inner.into_in(self.allocator)) - } - /// Build a [`JSXIdentifier`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_identifier`] instead. @@ -15001,15 +12949,6 @@ impl<'a> AstBuilder<'a> { JSXChild::Text(self.alloc(self.jsx_text(span, value))) } - /// Convert a [`JSXText`] into a [`JSXChild::Text`] - #[inline] - pub fn jsx_child_from_jsx_text(self, inner: T) -> JSXChild<'a> - where - T: IntoIn<'a, Box<'a, JSXText<'a>>>, - { - JSXChild::Text(inner.into_in(self.allocator)) - } - /// Build a [`JSXChild::Element`] /// /// This node contains a [`JSXElement`] that will be stored in the memory arena. @@ -15039,15 +12978,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXElement`] into a [`JSXChild::Element`] - #[inline] - pub fn jsx_child_from_jsx_element(self, inner: T) -> JSXChild<'a> - where - T: IntoIn<'a, Box<'a, JSXElement<'a>>>, - { - JSXChild::Element(inner.into_in(self.allocator)) - } - /// Build a [`JSXChild::Fragment`] /// /// This node contains a [`JSXFragment`] that will be stored in the memory arena. @@ -15073,15 +13003,6 @@ impl<'a> AstBuilder<'a> { ))) } - /// Convert a [`JSXFragment`] into a [`JSXChild::Fragment`] - #[inline] - pub fn jsx_child_from_jsx_fragment(self, inner: T) -> JSXChild<'a> - where - T: IntoIn<'a, Box<'a, JSXFragment<'a>>>, - { - JSXChild::Fragment(inner.into_in(self.allocator)) - } - /// Build a [`JSXChild::ExpressionContainer`] /// /// This node contains a [`JSXExpressionContainer`] that will be stored in the memory arena. @@ -15098,15 +13019,6 @@ impl<'a> AstBuilder<'a> { JSXChild::ExpressionContainer(self.alloc(self.jsx_expression_container(span, expression))) } - /// Convert a [`JSXExpressionContainer`] into a [`JSXChild::ExpressionContainer`] - #[inline] - pub fn jsx_child_from_jsx_expression_container(self, inner: T) -> JSXChild<'a> - where - T: IntoIn<'a, Box<'a, JSXExpressionContainer<'a>>>, - { - JSXChild::ExpressionContainer(inner.into_in(self.allocator)) - } - /// Build a [`JSXChild::Spread`] /// /// This node contains a [`JSXSpreadChild`] that will be stored in the memory arena. @@ -15123,15 +13035,6 @@ impl<'a> AstBuilder<'a> { JSXChild::Spread(self.alloc(self.jsx_spread_child(span, expression))) } - /// Convert a [`JSXSpreadChild`] into a [`JSXChild::Spread`] - #[inline] - pub fn jsx_child_from_jsx_spread_child(self, inner: T) -> JSXChild<'a> - where - T: IntoIn<'a, Box<'a, JSXSpreadChild<'a>>>, - { - JSXChild::Spread(inner.into_in(self.allocator)) - } - /// Build a [`JSXSpreadChild`]. /// /// If you want the built node to be allocated in the memory arena, use [`AstBuilder::alloc_jsx_spread_child`] instead. diff --git a/tasks/ast_tools/src/generators/ast_builder.rs b/tasks/ast_tools/src/generators/ast_builder.rs index c4285e7cd76ac..d402d3241c249 100644 --- a/tasks/ast_tools/src/generators/ast_builder.rs +++ b/tasks/ast_tools/src/generators/ast_builder.rs @@ -9,8 +9,7 @@ use syn::{parse_quote, Ident, Type}; use crate::{ output::{output_path, Output}, schema::{ - EnumDef, FieldDef, GetIdent, InheritDef, Schema, StructDef, ToType, TypeDef, TypeName, - VariantDef, + EnumDef, FieldDef, GetIdent, Schema, StructDef, ToType, TypeDef, TypeName, VariantDef, }, util::{TypeAnalysis, TypeWrapper}, Generator, @@ -105,39 +104,7 @@ fn generate_builder_fn(def: &TypeDef, schema: &Schema) -> TokenStream { } fn generate_enum_builder_fn(def: &EnumDef, schema: &Schema) -> TokenStream { - let variants_fns = - def.variants.iter().map(|it| generate_enum_variant_builder_fn(def, it, schema)); - - let inherits_fns = - def.inherits.iter().map(|it| generate_enum_inherit_builder_fn(def, it, schema)); - - variants_fns.chain(inherits_fns).collect() -} - -fn generate_enum_inherit_builder_fn( - enum_: &EnumDef, - inherit: &InheritDef, - _: &Schema, -) -> TokenStream { - let enum_ident = enum_.ident(); - let enum_as_type = enum_.to_type(); - let super_type = inherit.super_.to_type(); - let fn_name = - enum_builder_name(enum_ident.to_string(), inherit.super_.name().inner_name().to_string()); - - let docs = DocComment::new(format!( - "Convert a [`{}`] into the corresponding variant of [`{}`] without copying or re-allocating memory.", - inherit.super_.name(), - enum_ident - )); - quote! { - ///@@line_break - #docs - #[inline] - pub fn #fn_name(self, inner: #super_type) -> #enum_as_type { - #enum_ident::from(inner) - } - } + def.variants.iter().map(|it| generate_enum_variant_builder_fn(def, it, schema)).collect() } /// Create a builder function for an enum variant (e.g. for `Expression::Binary`) @@ -174,7 +141,6 @@ fn generate_enum_variant_builder_fn( does_alloc = true; } - let from_variant_builder = generate_enum_from_variant_builder_fn(enum_, variant, schema); let article = article_for(enum_ident.to_string()); let mut docs = DocComment::new(format!(" Build {article} [`{enum_ident}::{var_ident}`]")) .with_params(¶ms); @@ -193,40 +159,6 @@ fn generate_enum_variant_builder_fn( pub fn #fn_name #generic_params (self, #(#params),*) -> #enum_type #where_clause { #enum_ident::#var_ident(#inner) } - - #from_variant_builder - } -} - -/// Generate a conversion function that takes some struct and creates an enum -/// variant containing that struct using the `IntoIn` trait. -fn generate_enum_from_variant_builder_fn( - enum_: &EnumDef, - variant: &VariantDef, - _: &Schema, -) -> TokenStream { - assert_eq!(variant.fields.len(), 1); - let enum_ident = enum_.ident(); - let enum_type = &enum_.to_type(); - let var_ident = &variant.ident(); - let var_type_ref = &variant.fields.first().expect("we have already asserted this one!").typ; - let var_type_name = var_type_ref.name().inner_name(); - let var_type = var_type_ref.to_type(); - let fn_name = enum_builder_name(enum_ident.to_string(), format!("From{var_type_name}")); - - let from_article = article_for(var_type_name); - let to_article = article_for(enum_ident.to_string()); - - let docs = DocComment::new(format!( - " Convert {from_article} [`{var_type_name}`] into {to_article} [`{enum_ident}::{var_ident}`]", - )); - quote! { - ///@@line_break - #docs - #[inline] - pub fn #fn_name(self, inner: T) -> #enum_type where T: IntoIn<'a, #var_type> { - #enum_ident::#var_ident(inner.into_in(self.allocator)) - } } }