Unverified Commit cc3c9f63 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: bail instead of panic (#86470)

Eventual consistency strikes again

We already had the infrastructure here to store a result in the swc visitor.
parent 4d7d9abc
...@@ -1316,7 +1316,8 @@ async fn merge_modules( ...@@ -1316,7 +1316,8 @@ async fn merge_modules(
// corresponding export in the module that exports it. // corresponding export in the module that exports it.
if let Some(&module) = self.reverse_module_contexts.get(ctxt) { if let Some(&module) = self.reverse_module_contexts.get(ctxt) {
let eval_context_exports = self.export_contexts.get(&module).unwrap(); let eval_context_exports = self.export_contexts.get(&module).unwrap();
// TODO looking up an Atom in a Map<RcStr, _> // TODO looking up an Atom in a Map<RcStr, _>, would ideally work without creating a
// RcStr every time.
let sym_rc_str: RcStr = sym.as_str().into(); let sym_rc_str: RcStr = sym.as_str().into();
let (local, local_ctxt) = if let Some((local, local_ctxt)) = let (local, local_ctxt) = if let Some((local, local_ctxt)) =
eval_context_exports.get(&sym_rc_str) eval_context_exports.get(&sym_rc_str)
...@@ -1329,10 +1330,11 @@ async fn merge_modules( ...@@ -1329,10 +1330,11 @@ async fn merge_modules(
// generating this variable. // generating this variable.
(None, SyntaxContext::empty()) (None, SyntaxContext::empty())
} else { } else {
panic!( self.error = Err(anyhow::anyhow!(
"Expected to find a local export for {sym} with ctxt {ctxt:#?} in \ "Expected to find a local export for {sym} with ctxt {ctxt:#?} in \
{eval_context_exports:?}", {eval_context_exports:?}",
); ));
return;
}; };
let global_ctxt = self.get_context_for(module, local_ctxt); let global_ctxt = self.get_context_for(module, local_ctxt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment