Skip to content

Commit

Permalink
[TRY]: synthesized_ctxt
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 22, 2021
1 parent fc2282b commit 22067ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions bundler/src/bundler/chunk/computed_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ where
None => bail!("{:?} should not be wrapped with a function", id),
};
let injected_ctxt = self.injected_ctxt;
let synthesized_ctxt = self.synthesized_ctxt;
module.sort(id, &ctx.graph, &self.cm);

let is_async = {
Expand All @@ -59,8 +60,8 @@ where

let stmts = {
let mut module = Module::from(module).fold_with(&mut ExportToReturn {
synthesized_ctxt: self.synthesized_ctxt,
injected_ctxt: self.injected_ctxt,
synthesized_ctxt,
injected_ctxt,
return_props: Default::default(),
esm_exports: &mut extra_exports,
module_var: &module_var_name,
Expand All @@ -74,7 +75,7 @@ where
//
// See: https://github.com/denoland/deno/issues/9200

if var.span.ctxt == injected_ctxt {
if var.span.ctxt == injected_ctxt || var.span.ctxt == synthesized_ctxt {
let decl = &var.decls[0];
match &decl.name {
Pat::Ident(i) => {
Expand Down Expand Up @@ -365,7 +366,9 @@ impl Fold for ExportToReturn<'_> {
self.export_key_value(
exported.clone(),
named.orig.clone(),
export.span.ctxt == self.injected_ctxt || export.src.is_some(),
export.span.ctxt == self.injected_ctxt
|| export.span.ctxt == self.synthesized_ctxt
|| export.src.is_some(),
);
}
None => {
Expand Down
4 changes: 2 additions & 2 deletions bundler/src/bundler/chunk/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ where
);

ExportNamedSpecifier {
span: DUMMY_SP,
span: DUMMY_SP.with_ctxt(self.synthesized_ctxt),
orig: id,
exported: Some(exported),
}
Expand Down Expand Up @@ -1108,7 +1108,7 @@ where

new.push(ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(
NamedExport {
span: export.span.with_ctxt(injected_ctxt),
span: export.span.with_ctxt(self.synthesized_ctxt),
specifiers: vec![specifier],
src: None,
type_only: false,
Expand Down

0 comments on commit 22067ef

Please sign in to comment.