construct.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. var _Reflect$construct = require("@babel/runtime-corejs3/core-js/reflect/construct");
  2. var _bindInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/bind");
  3. var setPrototypeOf = require("./setPrototypeOf.js");
  4. var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
  5. function _construct(Parent, args, Class) {
  6. if (isNativeReflectConstruct()) {
  7. module.exports = _construct = _Reflect$construct;
  8. module.exports["default"] = module.exports, module.exports.__esModule = true;
  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. };
  18. module.exports["default"] = module.exports, module.exports.__esModule = true;
  19. }
  20. return _construct.apply(null, arguments);
  21. }
  22. module.exports = _construct;
  23. module.exports["default"] = module.exports, module.exports.__esModule = true;