Skip to content

Commit

Permalink
chore: Fix for rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 12, 2024
1 parent 0960b23 commit b012d54
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
6 changes: 1 addition & 5 deletions crates/swc_ecma_compat_es2015/src/template_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions crates/swc_ecma_transforms_module/src/module_decl_strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
14 changes: 5 additions & 9 deletions crates/swc_ecma_transforms_typescript/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,21 +1003,17 @@ 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;

for mut module_item in n.take() {
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"
);
Expand Down Expand Up @@ -1166,7 +1162,7 @@ impl Transform {
expr.make_assign_to(
op!("="),
member_expr!(
unresolved_ctxt,
top_level_ctxt,
Default::default(),
module.exports
)
Expand Down
3 changes: 0 additions & 3 deletions crates/swc_ecma_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b012d54

Please sign in to comment.