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
Get operation on private accessor without getter should throw #12673
Comments
Hey @mkubilayk! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
Sigh, another difference with normal properties. |
We can inject the error in a new helper (we already have babel/packages/babel-helper-create-class-features-plugin/src/fields.js Lines 227 to 232 in 8fcba6e
Instead of checking if
We need to be careful when introducing a new helper, because it will throw an error if we try to inject it with older I'll mark this as a good first issue: it's not "easy", but it should be self-contained enough. If it is the first time that you contribute to Babel, follow these steps: (you need to have
|
@nicolo-ribaudo |
I'll take this, seems to be a quick fix. |
Bug Report
Current behavior
Transpiled code doesn't throw an error in
foo()
and returnsundefined
.Input Code
Expected behavior
new C().foo();
should throw aTypeError
.test262
test: get-access-of-missing-private-getter.js.Babel Configuration: See the REPL link
Environment
Possible Solution
_classPrivateFieldGet
helper should not fallback to returningdescriptor.value
ifdescriptor.get
is false-y. Ifget
property exists but isundefined
, it can throw this particular error.Additional context
See
PrivateFieldGet-6.b
from the spec:The text was updated successfully, but these errors were encountered: