Sha256: 0a8247989e9daa36d0d5c50a0b32209bc12269d144524d8f665e5976e52c2613

Contents?: true

Size: 684 Bytes

Versions: 29

Compression:

Stored size: 684 Bytes

Contents

"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();
  }

};

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
trusty-cms-4.1.9 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.1.8 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
tang-0.2.0 spec/tang_app/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.1.7 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
tang-0.1.0 spec/tang_app/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
tang-0.0.9 spec/tang_app/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.1.6 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.1.5 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
condenser-0.3 lib/condenser/processors/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js