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