Skip to content

Commit

Permalink
Try to make logical expression deoptimization more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed May 31, 2022
1 parent 2795815 commit 734f171
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ast/nodes/LogicalExpression.ts
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 734f171

Please sign in to comment.