Fix rewriteThis in helper-module-transforms for computed class… (#11109)

* Fix rewriteThis in helper-module-transforms for computed class elements

* Added test file and corrected the visitor

* Revert .gitignore

* Using skipAllButComputedKey method from plugin-replace-supers

* added tests for class methods

* Added tests for both class properties and methods and fixed skipping computed key for methods

* Fixed condition for class methods

* revised the conditions for class methods

* Added more tests and used else-if in classmethod condition

* Update packages/babel-helper-replace-supers/src/index.js

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Siddhant N Trivedi
2020-02-13 01:49:10 +05:30
committed by GitHub
parent 3fc904e1d4
commit 3c6a8ae200
15 changed files with 81 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
}
function skipAllButComputedKey(path: NodePath) {
export function skipAllButComputedKey(path: NodePath) {
// If the path isn't computed, just skip everything.
if (!path.node.computed) {
path.skip();