refactor(ast, transformer)!: remove IdentifierName::new method (#6784)

This commit is contained in:
overlookmotel 2024-10-23 03:36:30 +00:00
parent 2bee4e2735
commit c91ffbcb01
4 changed files with 6 additions and 11 deletions

View file

@ -299,13 +299,6 @@ impl<'a> Expression<'a> {
}
}
impl<'a> IdentifierName<'a> {
#[allow(missing_docs)]
pub fn new(span: Span, name: Atom<'a>) -> Self {
Self { span, name }
}
}
impl<'a> fmt::Display for IdentifierName<'a> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View file

@ -199,7 +199,9 @@ impl<'a> ModuleImportsStore<'a> {
Import::Named(import) => {
ImportDeclarationSpecifier::ImportSpecifier(ctx.ast.alloc_import_specifier(
SPAN,
ModuleExportName::IdentifierName(IdentifierName::new(SPAN, import.imported)),
ModuleExportName::IdentifierName(
ctx.ast.identifier_name(SPAN, import.imported),
),
import.local.create_binding_identifier(),
ImportOrExportKind::Value,
))

View file

@ -800,7 +800,7 @@ impl<'a, 'ctx> ReactJsx<'a, 'ctx> {
}
JSXMemberExpressionObject::ThisExpression(expr) => ctx.ast.expression_this(expr.span),
};
let property = IdentifierName::new(expr.property.span, expr.property.name.clone());
let property = ctx.ast.identifier_name(expr.property.span, expr.property.name.clone());
ctx.ast.member_expression_static(expr.span, object, property, false).into()
}

View file

@ -362,7 +362,7 @@ impl<'a, 'ctx> TypeScriptNamespace<'a, 'ctx> {
ctx.ast.member_expression_static(
SPAN,
parent_export,
IdentifierName::new(SPAN, real_name.clone()),
ctx.ast.identifier_name(SPAN, real_name.clone()),
false,
),
)
@ -387,7 +387,7 @@ impl<'a, 'ctx> TypeScriptNamespace<'a, 'ctx> {
let assign_left =
ctx.ast.simple_assignment_target_identifier_reference(SPAN, &real_name);
let assign_right = {
let property = IdentifierName::new(SPAN, real_name.clone());
let property = ctx.ast.identifier_name(SPAN, real_name.clone());
let logical_left =
ctx.ast.member_expression_static(SPAN, parent_export, property, false);
let op = LogicalOperator::Or;