mirror of
https://github.com/swc-project/swc.git
synced 2024-11-29 11:47:21 +03:00
chore: Fix for rebase
This commit is contained in:
parent
0960b23c04
commit
b012d54df6
@ -5,12 +5,8 @@ use swc_atoms::JsWord;
|
|||||||
use swc_common::{util::take::Take, BytePos, Spanned, DUMMY_SP};
|
use swc_common::{util::take::Take, BytePos, Spanned, DUMMY_SP};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_transforms_base::{helper, perf::Parallel};
|
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_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;
|
use swc_trace_macro::swc_trace;
|
||||||
|
|
||||||
pub fn template_literal(c: Config) -> impl Fold + VisitMut {
|
pub fn template_literal(c: Config) -> impl Fold + VisitMut {
|
||||||
|
@ -6,10 +6,8 @@ use swc_common::{
|
|||||||
Mark, Span, SyntaxContext,
|
Mark, Span, SyntaxContext,
|
||||||
};
|
};
|
||||||
use swc_ecma_ast::*;
|
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_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};
|
use crate::{module_ref_rewriter::ImportMap, SpanCtx};
|
||||||
|
|
||||||
|
@ -1003,12 +1003,9 @@ impl Transform {
|
|||||||
// NOTE: This is not correct!
|
// NOTE: This is not correct!
|
||||||
// However, all unresolved_span are used in TsImportExportAssignConfig::Classic
|
// However, all unresolved_span are used in TsImportExportAssignConfig::Classic
|
||||||
// which is deprecated and not used in real world.
|
// which is deprecated and not used in real world.
|
||||||
let unresolved_span = DUMMY_SP.apply_mark(self.unresolved_mark);
|
let top_level_ctxt = self.top_level_ctxt;
|
||||||
let cjs_require = quote_ident!(unresolved_span, "require");
|
let cjs_require = quote_ident!(top_level_ctxt, "require");
|
||||||
let cjs_exports = quote_ident!(unresolved_span, "exports");
|
let cjs_exports = quote_ident!(top_level_ctxt, "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 mut cjs_export_assign = None;
|
let mut cjs_export_assign = None;
|
||||||
|
|
||||||
@ -1016,8 +1013,7 @@ impl Transform {
|
|||||||
match &mut module_item {
|
match &mut module_item {
|
||||||
ModuleItem::ModuleDecl(ModuleDecl::TsImportEquals(decl)) if !decl.is_type_only => {
|
ModuleItem::ModuleDecl(ModuleDecl::TsImportEquals(decl)) if !decl.is_type_only => {
|
||||||
debug_assert_ne!(
|
debug_assert_ne!(
|
||||||
decl.id.span.ctxt(),
|
decl.id.ctxt, self.unresolved_ctxt,
|
||||||
self.unresolved_ctxt,
|
|
||||||
"TsImportEquals has top-level context and it should not be identical to \
|
"TsImportEquals has top-level context and it should not be identical to \
|
||||||
the unresolved mark"
|
the unresolved mark"
|
||||||
);
|
);
|
||||||
@ -1166,7 +1162,7 @@ impl Transform {
|
|||||||
expr.make_assign_to(
|
expr.make_assign_to(
|
||||||
op!("="),
|
op!("="),
|
||||||
member_expr!(
|
member_expr!(
|
||||||
unresolved_ctxt,
|
top_level_ctxt,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
module.exports
|
module.exports
|
||||||
)
|
)
|
||||||
|
@ -884,9 +884,6 @@ pub trait ExprExt {
|
|||||||
|
|
||||||
return (Pure, num_from_str(&s));
|
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 {
|
Expr::Ident(Ident { sym, ctxt, .. }) => match &**sym {
|
||||||
"undefined" | "NaN" if *ctxt == ctx.unresolved_ctxt => f64::NAN,
|
"undefined" | "NaN" if *ctxt == ctx.unresolved_ctxt => f64::NAN,
|
||||||
"Infinity" if *ctxt == ctx.unresolved_ctxt => f64::INFINITY,
|
"Infinity" if *ctxt == ctx.unresolved_ctxt => f64::INFINITY,
|
||||||
|
Loading…
Reference in New Issue
Block a user