You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
493 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = rewriteThis;
  6. function rewriteThis(programPath) {
  7. programPath.traverse(rewriteThisVisitor);
  8. }
  9. const rewriteThisVisitor = {
  10. ThisExpression(path) {
  11. path.replaceWith(path.scope.buildUndefinedNode());
  12. },
  13. Function(path) {
  14. if (!path.isArrowFunctionExpression()) path.skip();
  15. },
  16. ClassProperty(path) {
  17. path.skip();
  18. },
  19. ClassPrivateProperty(path) {
  20. path.skip();
  21. }
  22. };