From 2ad46b5562cad3547e67bc90b4b26f007cb172ef Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Fri, 6 May 2022 23:15:26 +0200 Subject: [PATCH] There is no such thing as a global syntax context --- packages/transformers/js/core/src/hoist.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/transformers/js/core/src/hoist.rs b/packages/transformers/js/core/src/hoist.rs index c1ed352733c..1a9f9783f6a 100644 --- a/packages/transformers/js/core/src/hoist.rs +++ b/packages/transformers/js/core/src/hoist.rs @@ -785,7 +785,7 @@ impl<'a> Fold for Hoist<'a> { return Ident::new("$parcel$global".into(), node.span); } - if node.span.ctxt() == self.collect.global_ctxt + if node.span.has_mark(self.collect.global_mark) && self.collect.decls.contains(&id!(node)) && !self.collect.should_wrap { @@ -1073,7 +1073,7 @@ pub struct Collect { pub source_map: Lrc, pub decls: HashSet, pub ignore_mark: Mark, - pub global_ctxt: SyntaxContext, + pub global_mark: Mark, pub static_cjs_exports: bool, pub has_cjs_exports: bool, pub is_esm: bool, @@ -1139,7 +1139,7 @@ impl Collect { source_map, decls, ignore_mark, - global_ctxt: SyntaxContext::empty().apply_mark(global_mark), + global_mark, static_cjs_exports: true, has_cjs_exports: false, is_esm: false, @@ -1548,7 +1548,7 @@ impl Visit for Collect { .or_insert_with(|| node.id.sym.clone()); } - if self.in_assign && node.id.span.ctxt() == self.global_ctxt { + if self.in_assign && node.id.span.has_mark(self.global_mark) { self .non_const_bindings .entry(id!(node.id)) @@ -1573,7 +1573,7 @@ impl Visit for Collect { .or_insert_with(|| node.key.sym.clone()); } - if self.in_assign && node.key.span.ctxt() == self.global_ctxt { + if self.in_assign && node.key.span.has_mark(self.global_mark) { self .non_const_bindings .entry(id!(node.key))