Remove babel-helper-builder-conditional-assignment-operator-visitor, unused in babel [skip ci] (#5676)

This commit is contained in:
Henry Zhu 2017-04-27 18:04:00 -04:00 committed by GitHub
parent 48de6b32de
commit 685006433b
4 changed files with 0 additions and 72 deletions

View File

@ -1,5 +0,0 @@
# babel-helper-builder-conditional-assignment-operator-visitor
## Usage
TODO

View File

@ -1,12 +0,0 @@
{
"name": "babel-helper-builder-conditional-assignment-operator-visitor",
"version": "7.0.0-alpha.9",
"description": "Helper function to build conditional assignment operator visitors",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-conditional-assignment-operator-visitor",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"babel-helper-explode-assignable-expression": "7.0.0-alpha.9",
"babel-types": "7.0.0-alpha.9"
}
}

View File

@ -1,52 +0,0 @@
import explode from "babel-helper-explode-assignable-expression";
import * as t from "babel-types";
export default function (
exports: Object,
opts: {
build: Function;
is: Function;
},
) {
const buildAssignment = function (left, right) {
return t.assignmentExpression("=", left, right);
};
exports.ExpressionStatement = function (path, file) {
// hit the `AssignmentExpression` one below
if (path.isCompletionRecord()) return;
const expr = path.node.expression;
if (!opts.is(expr, file)) return;
const nodes = [];
const exploded = explode(expr.left, nodes, file, path.scope);
nodes.push(t.ifStatement(
opts.build(exploded.uid, file),
t.expressionStatement(buildAssignment(exploded.ref, expr.right))
));
return nodes;
};
exports.AssignmentExpression = function (path, file) {
const node = path.node;
if (!opts.is(node, file)) return;
const nodes = [];
const exploded = explode(node.left, nodes, file, path.scope);
nodes.push(t.logicalExpression(
"&&",
opts.build(exploded.uid, file),
buildAssignment(exploded.ref, node.right)
));
// todo: duplicate expression node
nodes.push(exploded.ref);
return nodes;
};
}