27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
var getPrototypeOf = require("./getPrototypeOf.js");
|
|
var setPrototypeOf = require("./setPrototypeOf.js");
|
|
var isNativeFunction = require("./isNativeFunction.js");
|
|
var construct = require("./construct.js");
|
|
function _wrapNativeSuper(t) {
|
|
var r = "function" == typeof Map ? new Map() : void 0;
|
|
return module.exports = _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
if (null === t || !isNativeFunction(t)) return t;
|
|
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
if (void 0 !== r) {
|
|
if (r.has(t)) return r.get(t);
|
|
r.set(t, Wrapper);
|
|
}
|
|
function Wrapper() {
|
|
return construct(t, arguments, getPrototypeOf(this).constructor);
|
|
}
|
|
return Wrapper.prototype = Object.create(t.prototype, {
|
|
constructor: {
|
|
value: Wrapper,
|
|
enumerable: !1,
|
|
writable: !0,
|
|
configurable: !0
|
|
}
|
|
}), setPrototypeOf(Wrapper, t);
|
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _wrapNativeSuper(t);
|
|
}
|
|
module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; |