blob: c0ff6eaa02b8d073e19a976f9f176c6baa7b2653 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import setPrototypeOf from "./setPrototypeOf";
export default function _construct(Parent, args, Class) {
if (typeof Reflect !== "undefined" && Reflect.construct) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Parent.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
|