Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/oxc_ast/src/ast_builder_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ impl<'a> AstBuilder<'a> {
/// [`AssignmentTarget::AssignmentTargetIdentifier`] with no name and an empty [`Span`].
#[inline]
pub fn move_assignment_target(self, target: &mut AssignmentTarget<'a>) -> AssignmentTarget<'a> {
let dummy = self.simple_assignment_target_identifier_reference(SPAN, Atom::from(""));
let dummy =
self.simple_assignment_target_assignment_target_identifier(SPAN, Atom::from(""));
mem::replace(target, dummy.into())
}

Expand Down
70 changes: 31 additions & 39 deletions crates/oxc_ast/src/generated/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`: The name of the identifier being referenced.
#[inline]
pub fn expression_identifier_reference<A>(self, span: Span, name: A) -> Expression<'a>
pub fn expression_identifier<A>(self, span: Span, name: A) -> Expression<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand Down Expand Up @@ -1411,7 +1411,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `argument`: The expression being spread.
#[inline]
pub fn object_property_kind_spread_element(
pub fn object_property_kind_spread_property(
self,
span: Span,
argument: Expression<'a>,
Expand Down Expand Up @@ -1482,7 +1482,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`
#[inline]
pub fn property_key_identifier_name<A>(self, span: Span, name: A) -> PropertyKey<'a>
pub fn property_key_static_identifier<A>(self, span: Span, name: A) -> PropertyKey<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand Down Expand Up @@ -2289,7 +2289,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`: The name of the identifier being referenced.
#[inline]
pub fn simple_assignment_target_identifier_reference<A>(
pub fn simple_assignment_target_assignment_target_identifier<A>(
self,
span: Span,
name: A,
Expand Down Expand Up @@ -6965,11 +6965,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`
#[inline]
pub fn import_attribute_key_identifier_name<A>(
self,
span: Span,
name: A,
) -> ImportAttributeKey<'a>
pub fn import_attribute_key_identifier<A>(self, span: Span, name: A) -> ImportAttributeKey<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand Down Expand Up @@ -7218,7 +7214,7 @@ impl<'a> AstBuilder<'a> {
/// * `return_type`: The TypeScript return type annotation.
/// * `body`: The function body.
#[inline]
pub fn export_default_declaration_kind_function<T1, T2, T3, T4, T5>(
pub fn export_default_declaration_kind_function_declaration<T1, T2, T3, T4, T5>(
self,
span: Span,
r#type: FunctionType,
Expand Down Expand Up @@ -7271,7 +7267,7 @@ impl<'a> AstBuilder<'a> {
/// * `abstract`: Whether the class is abstract
/// * `declare`: Whether the class was `declare`ed
#[inline]
pub fn export_default_declaration_kind_class<T1, T2, T3>(
pub fn export_default_declaration_kind_class_declaration<T1, T2, T3>(
self,
span: Span,
r#type: ClassType,
Expand Down Expand Up @@ -7783,7 +7779,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `name`: The name of the identifier.
#[inline]
pub fn jsx_element_name_jsx_identifier<A>(self, span: Span, name: A) -> JSXElementName<'a>
pub fn jsx_element_name_identifier<A>(self, span: Span, name: A) -> JSXElementName<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand Down Expand Up @@ -7814,7 +7810,7 @@ impl<'a> AstBuilder<'a> {
/// * `namespace`: Namespace portion of the name, e.g. `Apple` in `<Apple:Orange />`
/// * `property`: Name portion of the name, e.g. `Orange` in `<Apple:Orange />`
#[inline]
pub fn jsx_element_name_jsx_namespaced_name(
pub fn jsx_element_name_namespaced_name(
self,
span: Span,
namespace: JSXIdentifier<'a>,
Expand All @@ -7832,7 +7828,7 @@ impl<'a> AstBuilder<'a> {
/// * `object`: The object being accessed. This is everything before the last `.`.
/// * `property`: The property being accessed. This is everything after the last `.`.
#[inline]
pub fn jsx_element_name_jsx_member_expression(
pub fn jsx_element_name_member_expression(
self,
span: Span,
object: JSXMemberExpressionObject<'a>,
Expand Down Expand Up @@ -7952,7 +7948,7 @@ impl<'a> AstBuilder<'a> {
/// * `object`: The object being accessed. This is everything before the last `.`.
/// * `property`: The property being accessed. This is everything after the last `.`.
#[inline]
pub fn jsx_member_expression_object_jsx_member_expression(
pub fn jsx_member_expression_object_member_expression(
self,
span: Span,
object: JSXMemberExpressionObject<'a>,
Expand Down Expand Up @@ -8014,7 +8010,7 @@ impl<'a> AstBuilder<'a> {
/// ## Parameters
/// * `span`: Node location in source code
#[inline]
pub fn jsx_expression_jsx_empty_expression(self, span: Span) -> JSXExpression<'a> {
pub fn jsx_expression_empty_expression(self, span: Span) -> JSXExpression<'a> {
JSXExpression::EmptyExpression(self.jsx_empty_expression(span))
}

Expand Down Expand Up @@ -8049,7 +8045,7 @@ impl<'a> AstBuilder<'a> {
/// * `name`: The name of the attribute. This is a prop in React-like applications.
/// * `value`: The value of the attribute. This can be a string literal, an expression,
#[inline]
pub fn jsx_attribute_item_jsx_attribute(
pub fn jsx_attribute_item_attribute(
self,
span: Span,
name: JSXAttributeName<'a>,
Expand All @@ -8066,7 +8062,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `argument`: The expression being spread.
#[inline]
pub fn jsx_attribute_item_jsx_spread_attribute(
pub fn jsx_attribute_item_spread_attribute(
self,
span: Span,
argument: Expression<'a>,
Expand Down Expand Up @@ -8150,7 +8146,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `name`: The name of the identifier.
#[inline]
pub fn jsx_attribute_name_jsx_identifier<A>(self, span: Span, name: A) -> JSXAttributeName<'a>
pub fn jsx_attribute_name_identifier<A>(self, span: Span, name: A) -> JSXAttributeName<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand All @@ -8166,7 +8162,7 @@ impl<'a> AstBuilder<'a> {
/// * `namespace`: Namespace portion of the name, e.g. `Apple` in `<Apple:Orange />`
/// * `property`: Name portion of the name, e.g. `Orange` in `<Apple:Orange />`
#[inline]
pub fn jsx_attribute_name_jsx_namespaced_name(
pub fn jsx_attribute_name_namespaced_name(
self,
span: Span,
namespace: JSXIdentifier<'a>,
Expand Down Expand Up @@ -8204,7 +8200,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `expression`: The expression inside the container.
#[inline]
pub fn jsx_attribute_value_jsx_expression_container(
pub fn jsx_attribute_value_expression_container(
self,
span: Span,
expression: JSXExpression<'a>,
Expand All @@ -8224,7 +8220,7 @@ impl<'a> AstBuilder<'a> {
/// * `closing_element`: Closing tag of the element. Will be [`None`] for self-closing tags.
/// * `children`: Children of the element. This can be text, other elements, or expressions.
#[inline]
pub fn jsx_attribute_value_jsx_element<T1, T2>(
pub fn jsx_attribute_value_element<T1, T2>(
self,
span: Span,
opening_element: T1,
Expand Down Expand Up @@ -8253,7 +8249,7 @@ impl<'a> AstBuilder<'a> {
/// * `closing_fragment`: `</>`
/// * `children`: Elements inside the fragment.
#[inline]
pub fn jsx_attribute_value_jsx_fragment(
pub fn jsx_attribute_value_fragment(
self,
span: Span,
opening_fragment: JSXOpeningFragment,
Expand Down Expand Up @@ -8306,7 +8302,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `value`: The text content.
#[inline]
pub fn jsx_child_jsx_text<A>(self, span: Span, value: A) -> JSXChild<'a>
pub fn jsx_child_text<A>(self, span: Span, value: A) -> JSXChild<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand All @@ -8323,7 +8319,7 @@ impl<'a> AstBuilder<'a> {
/// * `closing_element`: Closing tag of the element. Will be [`None`] for self-closing tags.
/// * `children`: Children of the element. This can be text, other elements, or expressions.
#[inline]
pub fn jsx_child_jsx_element<T1, T2>(
pub fn jsx_child_element<T1, T2>(
self,
span: Span,
opening_element: T1,
Expand All @@ -8347,7 +8343,7 @@ impl<'a> AstBuilder<'a> {
/// * `closing_fragment`: `</>`
/// * `children`: Elements inside the fragment.
#[inline]
pub fn jsx_child_jsx_fragment(
pub fn jsx_child_fragment(
self,
span: Span,
opening_fragment: JSXOpeningFragment,
Expand All @@ -8370,7 +8366,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `expression`: The expression inside the container.
#[inline]
pub fn jsx_child_jsx_expression_container(
pub fn jsx_child_expression_container(
self,
span: Span,
expression: JSXExpression<'a>,
Expand All @@ -8386,11 +8382,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: Node location in source code
/// * `expression`: The expression being spread.
#[inline]
pub fn jsx_child_jsx_spread_child(
self,
span: Span,
expression: Expression<'a>,
) -> JSXChild<'a> {
pub fn jsx_child_spread(self, span: Span, expression: Expression<'a>) -> JSXChild<'a> {
JSXChild::Spread(self.alloc_jsx_spread_child(span, expression))
}

Expand Down Expand Up @@ -8644,7 +8636,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`
#[inline]
pub fn ts_enum_member_name_identifier_name<A>(self, span: Span, name: A) -> TSEnumMemberName<'a>
pub fn ts_enum_member_name_identifier<A>(self, span: Span, name: A) -> TSEnumMemberName<'a>
where
A: IntoIn<'a, Atom<'a>>,
{
Expand All @@ -8660,7 +8652,7 @@ impl<'a> AstBuilder<'a> {
/// * `value`: The value of the string.
/// * `raw`: The raw string as it appears in source code.
#[inline]
pub fn ts_enum_member_name_string_literal<A>(
pub fn ts_enum_member_name_string<A>(
self,
span: Span,
value: A,
Expand Down Expand Up @@ -9360,7 +9352,7 @@ impl<'a> AstBuilder<'a> {
/// * `operator`
/// * `type_annotation`: The type being operated on
#[inline]
pub fn ts_type_type_operator(
pub fn ts_type_type_operator_type(
self,
span: Span,
operator: TSTypeOperatorOperator,
Expand Down Expand Up @@ -11729,7 +11721,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`
#[inline]
pub fn ts_type_predicate_name_identifier_name<A>(
pub fn ts_type_predicate_name_identifier<A>(
self,
span: Span,
name: A,
Expand All @@ -11745,7 +11737,7 @@ impl<'a> AstBuilder<'a> {
/// ## Parameters
/// * `span`: The [`Span`] covering this node
#[inline]
pub fn ts_type_predicate_name_this_type(self, span: Span) -> TSTypePredicateName<'a> {
pub fn ts_type_predicate_name_this(self, span: Span) -> TSTypePredicateName<'a> {
TSTypePredicateName::This(self.ts_this_type(span))
}

Expand Down Expand Up @@ -11850,7 +11842,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`: The identifier name being bound.
#[inline]
pub fn ts_module_declaration_name_binding_identifier<A>(
pub fn ts_module_declaration_name_identifier<A>(
self,
span: Span,
name: A,
Expand Down Expand Up @@ -12248,7 +12240,7 @@ impl<'a> AstBuilder<'a> {
/// * `span`: The [`Span`] covering this node
/// * `name`
#[inline]
pub fn ts_import_attribute_name_identifier_name<A>(
pub fn ts_import_attribute_name_identifier<A>(
self,
span: Span,
name: A,
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<'a> IsolatedDeclarations<'a> {
// A parameter property may not be declared using a binding pattern.(1187)
return None;
};
let key = self.ast.property_key_identifier_name(SPAN, ident_name);
let key = self.ast.property_key_static_identifier(SPAN, ident_name);
Some(self.ast.class_element_property_definition(
param.span,
PropertyDefinitionType::PropertyDefinition,
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'a> IsolatedDeclarations<'a> {

// Infinity
let expr = if v.is_infinite() {
self.ast.expression_identifier_reference(SPAN, "Infinity")
self.ast.expression_identifier(SPAN, "Infinity")
} else {
let value = if is_negative { -v } else { v };
self.ast.expression_numeric_literal(
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<'a> IsolatedDeclarations<'a> {
declarations,
self.is_declare(),
));
Some((Some(variable_statement), self.ast.expression_identifier_reference(SPAN, name)))
Some((Some(variable_statement), self.ast.expression_identifier(SPAN, name)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl<'a> IsolatedDeclarations<'a> {

let ts_type = self.ast.ts_type_tuple_type(SPAN, element_types);
if is_const {
self.ast.ts_type_type_operator(SPAN, TSTypeOperatorOperator::Readonly, ts_type)
self.ast.ts_type_type_operator_type(SPAN, TSTypeOperatorOperator::Readonly, ts_type)
} else {
ts_type
}
Expand Down
8 changes: 6 additions & 2 deletions crates/oxc_minifier/src/peephole/minimize_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ impl<'a> PeepholeOptimizations {
// The `_` will not be placed to the target code.
let target = std::mem::replace(
target,
ctx.ast.simple_assignment_target_identifier_reference(target.span(), "_"),
ctx.ast
.simple_assignment_target_assignment_target_identifier(target.span(), "_"),
);
Some(ctx.ast.expression_update(expr.span, UpdateOperator::Decrement, true, target))
}
Expand All @@ -471,7 +472,10 @@ impl<'a> PeepholeOptimizations {
// The `_` will not be placed to the target code.
let target = std::mem::replace(
target,
ctx.ast.simple_assignment_target_identifier_reference(target.span(), "_"),
ctx.ast.simple_assignment_target_assignment_target_identifier(
target.span(),
"_",
),
);
ctx.ast.expression_update(expr.span, UpdateOperator::Increment, true, target)
})
Expand Down
Loading
Loading