construct.js 1.1 KB

123456789101112131415161718192021
  1. var _bindInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/bind");
  2. var _Reflect$construct = require("@babel/runtime-corejs3/core-js/reflect/construct");
  3. var setPrototypeOf = require("./setPrototypeOf.js");
  4. var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
  5. function _construct(Parent, args, Class) {
  6. if (isNativeReflectConstruct()) {
  7. var _context;
  8. module.exports = _construct = _bindInstanceProperty(_context = _Reflect$construct).call(_context), module.exports.__esModule = true, module.exports["default"] = module.exports;
  9. } else {
  10. module.exports = _construct = function _construct(Parent, args, Class) {
  11. var a = [null];
  12. a.push.apply(a, args);
  13. var Constructor = _bindInstanceProperty(Function).apply(Parent, a);
  14. var instance = new Constructor();
  15. if (Class) setPrototypeOf(instance, Class.prototype);
  16. return instance;
  17. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  18. }
  19. return _construct.apply(null, arguments);
  20. }
  21. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;