facebookarchive/prepack

Fuse adjacent JOIN_GENERATORS with same path condition

開放

#2,565 建立於 2018年9月22日

 (0 則留言) (0 個反應) (0 位負責人)JavaScript (520 個分叉)batch import
Instant Renderenhancementhelp wantedlevel 2 (easy)

倉庫指標

星標
 (14,268 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

This...

let x = __abstract("boolean", "(x)");
if (x) console.log("Hello");
if (x) console.log(" World");

currently prepacks to

(function () {
  var _0 = x;

  if (_0) {
    console.log("Hello");
  }

  if (_0) {
    console.log(" World");
  }
})();

but should Prepack to

(function () {
  var _0 = x;

  if (_0) {
    console.log("Hello");
    console.log(" World");
  }
})();

(Seen arising from actual product code.)

貢獻者指南