github-pages-deploy-action/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js

31 lines
684 B
JavaScript
Raw Normal View History

2020-03-31 20:42:07 +08:00
"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();
}
};