facebookarchive/prepack

Prepack emits if-statements with no consequent or alternate code

Open

#2.220 geöffnet am 6. Juli 2018

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (520 Forks)batch import
Instant Renderenhancementhelp wantedlevel 1 (super easy)priority: lowserializer

Repository-Metriken

Stars
 (14.268 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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.

Contributor Guide