wrapNativeSuper.js 1.1 KB

123456789101112131415161718192021222324252627
  1. var getPrototypeOf = require("./getPrototypeOf.js");
  2. var setPrototypeOf = require("./setPrototypeOf.js");
  3. var isNativeFunction = require("./isNativeFunction.js");
  4. var construct = require("./construct.js");
  5. function _wrapNativeSuper(t) {
  6. var r = "function" == typeof Map ? new Map() : void 0;
  7. return module.exports = _wrapNativeSuper = function _wrapNativeSuper(t) {
  8. if (null === t || !isNativeFunction(t)) return t;
  9. if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
  10. if (void 0 !== r) {
  11. if (r.has(t)) return r.get(t);
  12. r.set(t, Wrapper);
  13. }
  14. function Wrapper() {
  15. return construct(t, arguments, getPrototypeOf(this).constructor);
  16. }
  17. return Wrapper.prototype = Object.create(t.prototype, {
  18. constructor: {
  19. value: Wrapper,
  20. enumerable: !1,
  21. writable: !0,
  22. configurable: !0
  23. }
  24. }), setPrototypeOf(Wrapper, t);
  25. }, module.exports.__esModule = true, module.exports["default"] = module.exports, _wrapNativeSuper(t);
  26. }
  27. module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;