1
|
var getPrototypeOf = require("./getPrototypeOf");
|
2
|
|
3
|
var isNativeReflectConstruct = require("./isNativeReflectConstruct");
|
4
|
|
5
|
var possibleConstructorReturn = require("./possibleConstructorReturn");
|
6
|
|
7
|
function _createSuper(Derived) {
|
8
|
return function () {
|
9
|
var Super = getPrototypeOf(Derived),
|
10
|
result;
|
11
|
|
12
|
if (isNativeReflectConstruct()) {
|
13
|
var NewTarget = getPrototypeOf(this).constructor;
|
14
|
result = Reflect.construct(Super, arguments, NewTarget);
|
15
|
} else {
|
16
|
result = Super.apply(this, arguments);
|
17
|
}
|
18
|
|
19
|
return possibleConstructorReturn(this, result);
|
20
|
};
|
21
|
}
|
22
|
|
23
|
module.exports = _createSuper;
|