#2220·prepack

Prepack emits if-statements with no consequent or alternate code

Author: NTillmannCreated Jul 6, 2018Updated Aug 2, 2020
Labelsenhancementhelp wantedserializerlevel 1 (super easy)priority: lowInstant Render

This

javascript
(function () {
  let n = global.__abstract ? __abstract("number", "23") : 23;
  if (n === 42) {
    let d = Date.now(); // dead pure generator entry
  }
})();

prepacks to

javascript
if (23 === 42) {}

which is obviously suboptimal.

During its fixpoint computation, the visitor should not visit the condition until at least one generator entry cannot be omitted.