From 4d2d214ec7fc4e861b05cfcff1d95bbcef25a29b Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed, 23 Oct 2024 03:36:32 +0000 Subject: [PATCH] refactor(ast, transformer)!: remove `StringLiteral::new` method (#6788) --- crates/oxc_ast/src/ast_impl/literal.rs | 7 +------ crates/oxc_transformer/src/common/module_imports.rs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/oxc_ast/src/ast_impl/literal.rs b/crates/oxc_ast/src/ast_impl/literal.rs index a8919a9302e9c..0e12ff1cb3614 100644 --- a/crates/oxc_ast/src/ast_impl/literal.rs +++ b/crates/oxc_ast/src/ast_impl/literal.rs @@ -9,7 +9,7 @@ use std::{ use oxc_allocator::CloneIn; use oxc_regular_expression::ast::Pattern; -use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, Span}; +use oxc_span::{cmp::ContentEq, hash::ContentHash, Span}; use crate::ast::*; @@ -263,11 +263,6 @@ impl fmt::Display for RegExpFlags { } impl<'a> StringLiteral<'a> { - /// Create a new string literal representing the given `value`. - pub fn new(span: Span, value: Atom<'a>) -> Self { - Self { span, value } - } - /// Static Semantics: `IsStringWellFormedUnicode` /// test for \uD800-\uDFFF /// diff --git a/crates/oxc_transformer/src/common/module_imports.rs b/crates/oxc_transformer/src/common/module_imports.rs index 49fc904cd740a..2481d0c008976 100644 --- a/crates/oxc_transformer/src/common/module_imports.rs +++ b/crates/oxc_transformer/src/common/module_imports.rs @@ -214,7 +214,7 @@ impl<'a> ModuleImportsStore<'a> { let import_stmt = ctx.ast.module_declaration_import_declaration( SPAN, Some(specifiers), - StringLiteral::new(SPAN, source), + ctx.ast.string_literal(SPAN, source), NONE, ImportOrExportKind::Value, );