You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
869 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _helperPluginUtils = require("@babel/helper-plugin-utils");
  7. var _pluginSyntaxOptionalCatchBinding = _interopRequireDefault(require("@babel/plugin-syntax-optional-catch-binding"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. var _default = (0, _helperPluginUtils.declare)(api => {
  10. api.assertVersion(7);
  11. return {
  12. name: "proposal-optional-catch-binding",
  13. inherits: _pluginSyntaxOptionalCatchBinding.default,
  14. visitor: {
  15. CatchClause(path) {
  16. if (!path.node.param) {
  17. const uid = path.scope.generateUidIdentifier("unused");
  18. const paramPath = path.get("param");
  19. paramPath.replaceWith(uid);
  20. }
  21. }
  22. }
  23. };
  24. });
  25. exports.default = _default;