prepack icon indicating copy to clipboard operation
prepack copied to clipboard

Prepack emits if-statements with no consequent or alternate code

Open NTillmann opened this issue 6 years ago • 3 comments

This

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

prepacks to

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.

NTillmann avatar Jul 06 '18 23:07 NTillmann

This sounds interesting to look at. Any pointers on where to start looking?

Gyran avatar Oct 03 '18 13:10 Gyran

Should the output be just nothing?

Gyran avatar Oct 03 '18 13:10 Gyran

@NTillmann I am new here, could you tell me more about this issue?

jhalak27 avatar Aug 02 '20 14:08 jhalak27