diff options
Diffstat (limited to 'assets/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js')
-rw-r--r-- | assets/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/assets/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/assets/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js new file mode 100644 index 0000000..5c55d05 --- /dev/null +++ b/assets/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js @@ -0,0 +1,37 @@ +import getPrototypeOf from "./getPrototypeOf"; +import setPrototypeOf from "./setPrototypeOf"; +import isNativeFunction from "./isNativeFunction"; +import construct from "./construct"; +export default function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return construct(Class, arguments, getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); +}
\ No newline at end of file |