Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | var getPrototypeOf = require("./getPrototypeOf.js");
|
---|
2 |
|
---|
3 | var setPrototypeOf = require("./setPrototypeOf.js");
|
---|
4 |
|
---|
5 | var isNativeFunction = require("./isNativeFunction.js");
|
---|
6 |
|
---|
7 | var construct = require("./construct.js");
|
---|
8 |
|
---|
9 | function _wrapNativeSuper(Class) {
|
---|
10 | var _cache = typeof Map === "function" ? new Map() : undefined;
|
---|
11 |
|
---|
12 | module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
|
---|
13 | if (Class === null || !isNativeFunction(Class)) return Class;
|
---|
14 |
|
---|
15 | if (typeof Class !== "function") {
|
---|
16 | throw new TypeError("Super expression must either be null or a function");
|
---|
17 | }
|
---|
18 |
|
---|
19 | if (typeof _cache !== "undefined") {
|
---|
20 | if (_cache.has(Class)) return _cache.get(Class);
|
---|
21 |
|
---|
22 | _cache.set(Class, Wrapper);
|
---|
23 | }
|
---|
24 |
|
---|
25 | function Wrapper() {
|
---|
26 | return construct(Class, arguments, getPrototypeOf(this).constructor);
|
---|
27 | }
|
---|
28 |
|
---|
29 | Wrapper.prototype = Object.create(Class.prototype, {
|
---|
30 | constructor: {
|
---|
31 | value: Wrapper,
|
---|
32 | enumerable: false,
|
---|
33 | writable: true,
|
---|
34 | configurable: true
|
---|
35 | }
|
---|
36 | });
|
---|
37 | return setPrototypeOf(Wrapper, Class);
|
---|
38 | };
|
---|
39 |
|
---|
40 | module.exports["default"] = module.exports, module.exports.__esModule = true;
|
---|
41 | return _wrapNativeSuper(Class);
|
---|
42 | }
|
---|
43 |
|
---|
44 | module.exports = _wrapNativeSuper;
|
---|
45 | module.exports["default"] = module.exports, module.exports.__esModule = true; |
---|
Note:
See
TracBrowser
for help on using the repository browser.