source: trip-planner-front/node_modules/@babel/helper-builder-binary-assignment-operator-visitor/lib/index.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 998 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _default;
7
8var _helperExplodeAssignableExpression = require("@babel/helper-explode-assignable-expression");
9
10var _t = require("@babel/types");
11
12const {
13 assignmentExpression,
14 sequenceExpression
15} = _t;
16
17function _default(opts) {
18 const {
19 build,
20 operator
21 } = opts;
22 return {
23 AssignmentExpression(path) {
24 const {
25 node,
26 scope
27 } = path;
28 if (node.operator !== operator + "=") return;
29 const nodes = [];
30 const exploded = (0, _helperExplodeAssignableExpression.default)(node.left, nodes, this, scope);
31 nodes.push(assignmentExpression("=", exploded.ref, build(exploded.uid, node.right)));
32 path.replaceWith(sequenceExpression(nodes));
33 },
34
35 BinaryExpression(path) {
36 const {
37 node
38 } = path;
39
40 if (node.operator === operator) {
41 path.replaceWith(build(node.left, node.right));
42 }
43 }
44
45 };
46}
Note: See TracBrowser for help on using the repository browser.