Sha256: 432b14e3539f7acf82f51ee4f2621608728fecc9574575428e87fc842b7b722d

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;
var _t = require("@babel/types");
var _explodeAssignableExpression = require("./explode-assignable-expression.js");
const {
  assignmentExpression,
  sequenceExpression
} = _t;
function _default(opts) {
  const {
    build,
    operator
  } = opts;
  const visitor = {
    AssignmentExpression(path) {
      const {
        node,
        scope
      } = path;
      if (node.operator !== operator + "=") return;
      const nodes = [];
      const exploded = (0, _explodeAssignableExpression.default)(node.left, nodes, scope);
      nodes.push(assignmentExpression("=", exploded.ref, build(exploded.uid, node.right)));
      path.replaceWith(sequenceExpression(nodes));
    },
    BinaryExpression(path) {
      const {
        node
      } = path;
      if (node.operator === operator) {
        path.replaceWith(build(node.left, node.right));
      }
    }
  };
  return visitor;
}

//# sourceMappingURL=index.js.map

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.50 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.49 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.48 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.47 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.46 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js
immosquare-cleaner-0.1.45 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js