From 734f171fc017eb399ff430dee2dd4c7a48f962e9 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 31 May 2022 13:09:18 +0200 Subject: [PATCH] Try to make logical expression deoptimization more robust --- src/ast/nodes/LogicalExpression.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index 24cc3594039..763ff942b69 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -42,13 +42,16 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable private usedBranch: ExpressionNode | null = null; deoptimizeCache(): void { - if (this.usedBranch !== null) { + if (this.usedBranch) { const unusedBranch = this.usedBranch === this.left ? this.right : this.left; this.usedBranch = null; unusedBranch.deoptimizePath(UNKNOWN_PATH); for (const expression of this.expressionsToBeDeoptimized) { expression.deoptimizeCache(); } + // Request another pass because we need to ensure "include" runs again if + // it is rendered + this.context.requestTreeshakingPass(); } }