aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
blob: e75cc39a166237c61429591330ac03e0e9d72b58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict";

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

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

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

  Function(path) {
    if (!path.isArrowFunctionExpression()) path.skip();
  },

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

};