Skip to content

Commit

Permalink
There is no such thing as a global syntax context
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed May 6, 2022
1 parent 87927c7 commit 2ad46b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/transformers/js/core/src/hoist.rs
Expand Up @@ -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
{
Expand Down Expand Up @@ -1073,7 +1073,7 @@ pub struct Collect {
pub source_map: Lrc<swc_common::SourceMap>,
pub decls: HashSet<IdentId>,
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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 2ad46b5

Please sign in to comment.