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

Should not drop unused setter arguments #267

Closed
paleolitico opened this issue Nov 14, 2016 · 0 comments
Closed

Should not drop unused setter arguments #267

paleolitico opened this issue Nov 14, 2016 · 0 comments
Labels
bug Confirmed bug
Milestone

Comments

@paleolitico
Copy link

If a setter don't use its argument, plugin babel-plugin-minify-dead-code-elimination removes it. But a setter must always have exactly one argument.

The following mocha+should test passes with babili 0.0.8 (when it shouldn't):

describe("babili", function() {
  describe("has a bug", function() {
    it("with setters that don't use its argument", function() {
      var code = "class C {set field(x) {this._x = 10;}} var x = new C()";
      var min = babel.transform(code, {presets:["babili"], comments:false})
        .code;
      min.should.match(/set field\(\)/);
      (() => eval(min)).should
        .throw(/Setter must have exactly one formal parameter/);
    });
  });
});
@boopathi boopathi added the bug Confirmed bug label Nov 14, 2016
@boopathi boopathi added this to the 0.0.9 milestone Nov 14, 2016
@kangax kangax closed this as completed in 2ec0e2f Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants