chore: Fix for rebase

This commit is contained in:
강동윤 (Donny) 2024-07-12 12:43:48 +09:00 committed by Donny/강동윤
parent 0960b23c04
commit b012d54df6
4 changed files with 7 additions and 20 deletions

View File

@ -5,12 +5,8 @@ use swc_atoms::JsWord;
use swc_common::{util::take::Take, BytePos, Spanned, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms_base::{helper, perf::Parallel};
use swc_ecma_utils::{
is_literal, prepend_stmts, private_ident, quote_ident, ExprFactory, StmtLike,
};
use swc_ecma_visit::{as_folder, standard_only_visit_mut, Fold, VisitMut, VisitMutWith};
use swc_ecma_utils::{is_literal, prepend_stmts, private_ident, quote_ident, ExprFactory};
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
use swc_ecma_visit::{as_folder, standard_only_visit_mut, Fold, VisitMut, VisitMutWith};
use swc_trace_macro::swc_trace;
pub fn template_literal(c: Config) -> impl Fold + VisitMut {

View File

@ -6,10 +6,8 @@ use swc_common::{
Mark, Span, SyntaxContext,
};
use swc_ecma_ast::*;
use swc_ecma_utils::{find_pat_ids, ident::IdentLike, private_ident, quote_ident, ExprFactory};
use swc_ecma_visit::{standard_only_visit_mut, VisitMut, VisitMutWith};
use swc_ecma_utils::{find_pat_ids, private_ident, quote_ident, ExprFactory};
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use swc_ecma_visit::{standard_only_visit_mut, VisitMut, VisitMutWith};
use crate::{module_ref_rewriter::ImportMap, SpanCtx};

View File

@ -1003,12 +1003,9 @@ impl Transform {
// NOTE: This is not correct!
// However, all unresolved_span are used in TsImportExportAssignConfig::Classic
// which is deprecated and not used in real world.
let unresolved_span = DUMMY_SP.apply_mark(self.unresolved_mark);
let cjs_require = quote_ident!(unresolved_span, "require");
let cjs_exports = quote_ident!(unresolved_span, "exports");
let unresolved_ctxt = SyntaxContext::empty().apply_mark(self.top_level_mark);
let cjs_require = quote_ident!(unresolved_ctxt, "require");
let cjs_exports = quote_ident!(unresolved_ctxt, "exports");
let top_level_ctxt = self.top_level_ctxt;
let cjs_require = quote_ident!(top_level_ctxt, "require");
let cjs_exports = quote_ident!(top_level_ctxt, "exports");
let mut cjs_export_assign = None;
@ -1016,8 +1013,7 @@ impl Transform {
match &mut module_item {
ModuleItem::ModuleDecl(ModuleDecl::TsImportEquals(decl)) if !decl.is_type_only => {
debug_assert_ne!(
decl.id.span.ctxt(),
self.unresolved_ctxt,
decl.id.ctxt, self.unresolved_ctxt,
"TsImportEquals has top-level context and it should not be identical to \
the unresolved mark"
);
@ -1166,7 +1162,7 @@ impl Transform {
expr.make_assign_to(
op!("="),
member_expr!(
unresolved_ctxt,
top_level_ctxt,
Default::default(),
module.exports
)

View File

@ -884,9 +884,6 @@ pub trait ExprExt {
return (Pure, num_from_str(&s));
}
Expr::Ident(Ident { sym, span, .. }) => match &**sym {
"undefined" | "NaN" if span.ctxt == ctx.unresolved_ctxt => f64::NAN,
"Infinity" if span.ctxt == ctx.unresolved_ctxt => f64::INFINITY,
Expr::Ident(Ident { sym, ctxt, .. }) => match &**sym {
"undefined" | "NaN" if *ctxt == ctx.unresolved_ctxt => f64::NAN,
"Infinity" if *ctxt == ctx.unresolved_ctxt => f64::INFINITY,