Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: 10-22-refactor_ast_transformer_remove_blockstatement_new_methods
Choose a base branch
from
Open
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
7 changes: 0 additions & 7 deletions crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_transformer/src/common/module_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/react/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_transformer/src/typescript/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
)
Expand All @@ -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;
Expand Down
Loading