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

private-methods loose doesn't work without class properties #9424

Open
nicolo-ribaudo opened this Issue Jan 28, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Jan 28, 2019

Bug Report

Input Code

  class X {
    #foo() {}
  }

Current output

class X {
  constructor() {
    _foo.add(this);
  }

}

var _foo = new WeakSet();

var _foo2 = function _foo2() {};

Expected output

class X {
  constructor() {
    Object.defineProperty(this, _foo, {
      value: _foo2
    });
  }

}

var _foo = babelHelpers.classPrivateFieldLooseKey("foo");

var _foo2 = function _foo2() {};

Babel Configuration (.babelrc, package.json, cli command)

{
  "plugins": [
    ["external-helpers", { "helperVersion": "7.1000.0" }],
    ["proposal-private-methods", { "loose": true }]
  ]
}

Environment

  • Babel version(s): v7.3.0
@nicolo-ribaudo

This comment has been minimized.

Copy link
Member Author

nicolo-ribaudo commented Jan 28, 2019

If anyone wants to take a look at this issue, the problem is probably in the entry point of @babel/helper-create-class-features-plugin.

@Chrisyee22

This comment has been minimized.

Copy link

Chrisyee22 commented Jan 29, 2019

Could I have a look at this issue?

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member Author

nicolo-ribaudo commented Jan 29, 2019

Yes 👍 If you need anything, feel free to contact me on Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment