Files
setup-helm/node_modules/@babel/helper-environment-visitor/lib/index.js

59 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-06-27 14:17:15 -04:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
2022-07-11 13:48:02 -04:00
exports.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators;
2022-06-27 14:17:15 -04:00
exports.skipAllButComputedKey = skipAllButComputedKey;
function skipAllButComputedKey(path) {
2022-07-11 13:48:02 -04:00
path.skip();
if (path.node.computed) {
path.context.maybeQueue(path.get("key"));
2022-06-27 14:17:15 -04:00
}
2022-07-11 13:48:02 -04:00
}
2022-06-27 14:17:15 -04:00
2022-07-11 13:48:02 -04:00
function requeueComputedKeyAndDecorators(path) {
const {
context,
node
} = path;
2022-06-27 14:17:15 -04:00
2022-07-11 13:48:02 -04:00
if (node.computed) {
context.maybeQueue(path.get("key"));
}
if (node.decorators) {
for (const decorator of path.get("decorators")) {
context.maybeQueue(decorator);
}
2022-06-27 14:17:15 -04:00
}
}
2022-07-11 13:48:02 -04:00
const visitor = {
FunctionParent(path) {
if (path.isArrowFunctionExpression()) {
return;
} else {
path.skip();
if (path.isMethod()) {
requeueComputedKeyAndDecorators(path);
}
}
},
2022-06-27 14:17:15 -04:00
2022-07-11 13:48:02 -04:00
Property(path) {
if (path.isObjectProperty()) {
return;
}
path.skip();
requeueComputedKeyAndDecorators(path);
2022-06-27 14:17:15 -04:00
}
};
2022-07-11 13:48:02 -04:00
var _default = visitor;
2022-06-27 14:17:15 -04:00
exports.default = _default;