facebookarchive/prepack

Prepack emits if-statements with no consequent or alternate code

Open

#2220 aperta il 6 lug 2018

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)JavaScript (520 fork)batch import
Instant Renderenhancementhelp wantedlevel 1 (super easy)priority: lowserializer

Metriche repository

Star
 (14.268 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor