facebookarchive/prepack

Prepack emits if-statements with no consequent or alternate code

Open

#2,220 创建于 2018年7月6日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)JavaScript (520 fork)batch import
Instant Renderenhancementhelp wantedlevel 1 (super easy)priority: lowserializer

仓库指标

Star
 (14,268 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南