aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/runtime/helpers/wrapNativeSuper.js')
-rw-r--r--node_modules/@babel/runtime/helpers/wrapNativeSuper.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
new file mode 100644
index 00000000..fe133e04
--- /dev/null
+++ b/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
@@ -0,0 +1,43 @@
+var _Object$create = require("../core-js/object/create");
+
+var _Map = require("../core-js/map");
+
+var getPrototypeOf = require("./getPrototypeOf");
+
+var setPrototypeOf = require("./setPrototypeOf");
+
+var construct = require("./construct");
+
+function _wrapNativeSuper(Class) {
+ var _cache = typeof _Map === "function" ? new _Map() : undefined;
+
+ module.exports = _wrapNativeSuper = function _wrapNativeSuper(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() {}
+
+ Wrapper.prototype = _Object$create(Class.prototype, {
+ constructor: {
+ value: Wrapper,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ return setPrototypeOf(Wrapper, setPrototypeOf(function Super() {
+ return construct(Class, arguments, getPrototypeOf(this).constructor);
+ }, Class));
+ };
+
+ return _wrapNativeSuper(Class);
+}
+
+module.exports = _wrapNativeSuper; \ No newline at end of file