summaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-transform-optional-catch-binding/lib/index.js
blob: b1e409e9895c7b92529a2722dca87b00e271d84d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
  api.assertVersion(7);
  return {
    name: "transform-optional-catch-binding",
    inherits: api.version[0] === "8" ? undefined : require("@babel/plugin-syntax-optional-catch-binding").default,
    visitor: {
      CatchClause(path) {
        if (!path.node.param) {
          const uid = path.scope.generateUidIdentifier("unused");
          const paramPath = path.get("param");
          paramPath.replaceWith(uid);
        }
      }
    }
  };
});

//# sourceMappingURL=index.js.map