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
optimacms-0.1.61 spec/dummy/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.7 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.6 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.5 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.4 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.3 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.2 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.1 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3.5 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-5.0.0 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3.4 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3.3 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3.2 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3.1 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.3 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.2.3 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
tang-0.2.1 spec/tang_app/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.2.2 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.2.1 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
trusty-cms-4.2 node_modules/@babel/helper-module-transforms/lib/rewrite-this.js