Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pierced bundler: run DCE to a fixpoint #60

Open
bakkot opened this Issue Apr 2, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@bakkot
Copy link
Collaborator

bakkot commented Apr 2, 2019

Consider the following program:

function a() {}
function b() { return a(); }
var c = 0;
var d = 1;
export { d };

If you run bandolier with that as the entrypoint, with default options, you get (an unformatted version of)

(function(w) {
  'use strict';
  function a() {}
  var d = 1;
  var e = { __proto__: null, d: d };
  if (w.Symbol)
    w.Object.defineProperty(e, w.Symbol.toStringTag, { value: 'Module' });
  e = w.Object.freeze(e);
  return e;
})(this);

As you'd expect, b and c are eliminated. But a is not. This is presumably because it's only dead after b has been eliminated.

I think dead code elimination should be run to a fixpoint, so that a is removed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.