| @@ 28-39 (lines=12) @@ | ||
| 25 | return _setPrototypeOf(o, p); |
|
| 26 | } |
|
| 27 | ||
| 28 | function _isNativeReflectConstruct() { |
|
| 29 | if (typeof Reflect === "undefined" || !Reflect.construct) return false; |
|
| 30 | if (Reflect.construct.sham) return false; |
|
| 31 | if (typeof Proxy === "function") return true; |
|
| 32 | ||
| 33 | try { |
|
| 34 | Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); |
|
| 35 | return true; |
|
| 36 | } catch (e) { |
|
| 37 | return false; |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | function _construct(Parent, args, Class) { |
|
| 42 | if (_isNativeReflectConstruct()) { |
|
| @@ 18-18 (lines=1) @@ | ||
| 15 | ||
| 16 | function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } |
|
| 17 | ||
| 18 | function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } |
|
| 19 | ||
| 20 | function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } |
|
| 21 | ||