035d7e2dc3b16fc2e141ec07c3746e546d3b289d.svn-base 684 Bytes
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = rewriteThis;

var _helperReplaceSupers = require("@babel/helper-replace-supers");

function rewriteThis(programPath) {
  programPath.traverse(rewriteThisVisitor);
}

const rewriteThisVisitor = {
  ThisExpression(path) {
    path.replaceWith(path.scope.buildUndefinedNode());
  },

  Function(path) {
    if (path.isMethod()) (0, _helperReplaceSupers.skipAllButComputedKey)(path);else if (!path.isArrowFunctionExpression()) path.skip();
  },

  ClassProperty(path) {
    (0, _helperReplaceSupers.skipAllButComputedKey)(path);
  },

  ClassPrivateProperty(path) {
    path.skip();
  }

};