mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(ast, transformer)!: remove IdentifierName::new method (#6784)
This commit is contained in:
parent
2bee4e2735
commit
c91ffbcb01
4 changed files with 6 additions and 11 deletions
|
|
@ -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> {
|
impl<'a> fmt::Display for IdentifierName<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,9 @@ impl<'a> ModuleImportsStore<'a> {
|
||||||
Import::Named(import) => {
|
Import::Named(import) => {
|
||||||
ImportDeclarationSpecifier::ImportSpecifier(ctx.ast.alloc_import_specifier(
|
ImportDeclarationSpecifier::ImportSpecifier(ctx.ast.alloc_import_specifier(
|
||||||
SPAN,
|
SPAN,
|
||||||
ModuleExportName::IdentifierName(IdentifierName::new(SPAN, import.imported)),
|
ModuleExportName::IdentifierName(
|
||||||
|
ctx.ast.identifier_name(SPAN, import.imported),
|
||||||
|
),
|
||||||
import.local.create_binding_identifier(),
|
import.local.create_binding_identifier(),
|
||||||
ImportOrExportKind::Value,
|
ImportOrExportKind::Value,
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,7 @@ impl<'a, 'ctx> ReactJsx<'a, 'ctx> {
|
||||||
}
|
}
|
||||||
JSXMemberExpressionObject::ThisExpression(expr) => ctx.ast.expression_this(expr.span),
|
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()
|
ctx.ast.member_expression_static(expr.span, object, property, false).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ impl<'a, 'ctx> TypeScriptNamespace<'a, 'ctx> {
|
||||||
ctx.ast.member_expression_static(
|
ctx.ast.member_expression_static(
|
||||||
SPAN,
|
SPAN,
|
||||||
parent_export,
|
parent_export,
|
||||||
IdentifierName::new(SPAN, real_name.clone()),
|
ctx.ast.identifier_name(SPAN, real_name.clone()),
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -387,7 +387,7 @@ impl<'a, 'ctx> TypeScriptNamespace<'a, 'ctx> {
|
||||||
let assign_left =
|
let assign_left =
|
||||||
ctx.ast.simple_assignment_target_identifier_reference(SPAN, &real_name);
|
ctx.ast.simple_assignment_target_identifier_reference(SPAN, &real_name);
|
||||||
let assign_right = {
|
let assign_right = {
|
||||||
let property = IdentifierName::new(SPAN, real_name.clone());
|
let property = ctx.ast.identifier_name(SPAN, real_name.clone());
|
||||||
let logical_left =
|
let logical_left =
|
||||||
ctx.ast.member_expression_static(SPAN, parent_export, property, false);
|
ctx.ast.member_expression_static(SPAN, parent_export, property, false);
|
||||||
let op = LogicalOperator::Or;
|
let op = LogicalOperator::Or;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue