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
Fix classNameTDZError in computed prototype methods with class fields #11068
Fix classNameTDZError in computed prototype methods with class fields #11068
Conversation
sidntrivedi012
commented
Jan 29, 2020
•
edited
edited
Q | A |
---|---|
Fixed Issues? | Fixes #10766 |
Patch: Bug Fix? | 👍 |
Major: Breaking Change? | No |
Minor: New Feature? | No |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
...in/test/fixtures/plugin-proposal-class-properties/tdz-error-computed-prototypes/options.json
Outdated
Show resolved
Hide resolved
@nicolo-ribaudo Have extracted the method But, |
Instead of |
classBinding: path.node.id && path.scope.getBinding(path.node.id.name), | ||
file, | ||
}); | ||
if (computedPath.get("key").isReferencedIdentifier()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we cache computedPath.get("key")
? It is also used in !computedPath.get("key").isConstantExpression()
later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JLHwung Done. PTAL 🙂
…babel#11068) * Draft fix for TDZError in computed prototype methods * Added tests for loose:false and also extracted handleClassTDZ * Added state parameter to handleClassTDZ function * Extracted the state object to a variable * Added helper comments for environmentVisitor * Added else condition to traverse computed Path * Cached computed path key into a variable