Unverified Commit 7e32b38b authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: fix another case of edge runtime warnings (#70455)

Closes PACK-3276
parent 178f8a00
...@@ -298,10 +298,16 @@ impl Visit for WarnForEdgeRuntime { ...@@ -298,10 +298,16 @@ impl Visit for WarnForEdgeRuntime {
fn visit_bin_expr(&mut self, node: &BinExpr) { fn visit_bin_expr(&mut self, node: &BinExpr) {
match node.op { match node.op {
op!("&&") | op!("||") | op!("??") => { op!("&&") | op!("||") | op!("??") => {
self.with_new_scope(move |this| { if self.should_add_guards {
this.add_guards(&node.left); // This is a condition and not a shorthand for if-then
node.right.visit_with(this); self.add_guards(&node.left);
}); node.right.visit_with(self);
} else {
self.with_new_scope(move |this| {
this.add_guards(&node.left);
node.right.visit_with(this);
});
}
} }
op!("==") | op!("===") => { op!("==") | op!("===") => {
self.add_guard_for_test(&node.left); self.add_guard_for_test(&node.left);
......
if (typeof process.loadEnvFile === 'function') { if (typeof process.loadEnvFile === 'function') {
console.log(process.loadEnvFile()) console.log(process.loadEnvFile())
} }
typeof process < 'u' &&
typeof process.off == 'function' &&
(process.off('uncaughtException', this.onUncaughtException),
process.off('unhandledRejection', this.onUncaughtRejection))
if (typeof process.loadEnvFile === 'function') { if (typeof process.loadEnvFile === 'function') {
console.log(process.loadEnvFile()); console.log(process.loadEnvFile());
} }
typeof process < 'u' && typeof process.off == 'function' && (process.off('uncaughtException', this.onUncaughtException), process.off('unhandledRejection', this.onUncaughtRejection));
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