| Server IP : 46.62.235.243 / Your IP : 216.73.216.163 Web Server : Apache/2.4.58 (Ubuntu) System : Linux Linkabili3Dicembre 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/node_modules/@babel/plugin-proposal-pipeline-operator/lib/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _core = require("@babel/core");
const topicReferenceVisitor = {
exit(path, state) {
if (path.isTopicReference()) {
state.topicReferences.push(path);
} else {
if (state.topicReferences.length === 0 && !state.sideEffectsBeforeFirstTopicReference && !path.isPure()) {
state.sideEffectsBeforeFirstTopicReference = true;
}
}
},
"ClassBody|Function"(_, state) {
if (state.topicReferences.length === 0) {
state.sideEffectsBeforeFirstTopicReference = true;
}
}
};
const visitor = {
BinaryExpression: {
exit(path) {
const {
scope,
node
} = path;
if (node.operator !== "|>") {
return;
}
const pipeBodyPath = path.get("right");
if (pipeBodyPath.node.type === "TopicReference") {
path.replaceWith(node.left);
return;
}
const visitorState = {
topicReferences: [],
sideEffectsBeforeFirstTopicReference: pipeBodyPath.isFunction()
};
pipeBodyPath.traverse(topicReferenceVisitor, visitorState);
if (visitorState.topicReferences.length === 1 && (!visitorState.sideEffectsBeforeFirstTopicReference || path.scope.isPure(node.left, true))) {
visitorState.topicReferences[0].replaceWith(node.left);
path.replaceWith(node.right);
return;
}
const topicVariable = scope.generateUidIdentifierBasedOnNode(node);
scope.push({
id: topicVariable
});
visitorState.topicReferences.forEach(path => path.replaceWith(_core.types.cloneNode(topicVariable)));
path.replaceWith(_core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(topicVariable), node.left), node.right]));
}
}
};
var _default = visitor;
exports.default = _default;
//# sourceMappingURL=hackVisitor.js.map