mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 12:41:54 +03:00
26944e159d
swc_ecma_transforms_base: - Reimplement `hygiene`.
125 lines
4.6 KiB
JavaScript
125 lines
4.6 KiB
JavaScript
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
function _defineProperties(target, props) {
|
|
for(var i = 0; i < props.length; i++){
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
}
|
|
function _getPrototypeOf(o) {
|
|
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
}, _getPrototypeOf(o);
|
|
}
|
|
function _setPrototypeOf(o, p) {
|
|
return _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
return o.__proto__ = p, o;
|
|
}, _setPrototypeOf(o, p);
|
|
}
|
|
var arr, _typeof = function(obj) {
|
|
return obj && "undefined" != typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
};
|
|
(function() {
|
|
for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++)_tmp[_key] = arguments[_key];
|
|
var arr, i, __tmp = (i = 2, function(arr) {
|
|
if (Array.isArray(arr)) return arr;
|
|
}(arr = _tmp) || function(arr, i) {
|
|
var _arr = [], _n = !0, _d = !1, _e = void 0;
|
|
try {
|
|
for(var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !i || _arr.length !== i); _n = !0);
|
|
} catch (err) {
|
|
_d = !0, _e = err;
|
|
} finally{
|
|
try {
|
|
_n || null == _i.return || _i.return();
|
|
} finally{
|
|
if (_d) throw _e;
|
|
}
|
|
}
|
|
return _arr;
|
|
}(arr, i) || function() {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
}());
|
|
__tmp[0], __tmp[1];
|
|
}).apply(void 0, function(arr) {
|
|
if (Array.isArray(arr)) {
|
|
for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)arr2[i] = arr[i];
|
|
return arr2;
|
|
}
|
|
}(arr = new FooIteratorIterator) || function(iter) {
|
|
if (Symbol.iterator in Object(iter) || "[object Arguments]" === Object.prototype.toString.call(iter)) return Array.from(iter);
|
|
}(arr) || function() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
}());
|
|
var Bar1 = function() {
|
|
"use strict";
|
|
_classCallCheck(this, Bar1);
|
|
}, Foo = function(Bar) {
|
|
"use strict";
|
|
function Foo() {
|
|
var self, call;
|
|
return _classCallCheck(this, Foo), self = this, call = _getPrototypeOf(Foo).apply(this, arguments), call && ("object" === _typeof(call) || "function" == typeof call) ? call : (function(self) {
|
|
if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
return self;
|
|
})(self);
|
|
}
|
|
return !function(subClass, superClass) {
|
|
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function");
|
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
writable: !0,
|
|
configurable: !0
|
|
}
|
|
}), superClass && _setPrototypeOf(subClass, superClass);
|
|
}(Foo, Bar), Foo;
|
|
}(Bar1), tmp = Symbol.iterator, FooIterator = function() {
|
|
"use strict";
|
|
function FooIterator() {
|
|
_classCallCheck(this, FooIterator);
|
|
}
|
|
return _createClass(FooIterator, [
|
|
{
|
|
key: "next",
|
|
value: function() {
|
|
return {
|
|
value: new Foo,
|
|
done: !1
|
|
};
|
|
}
|
|
},
|
|
{
|
|
key: tmp,
|
|
value: function() {
|
|
return this;
|
|
}
|
|
}
|
|
]), FooIterator;
|
|
}(), tmp1 = Symbol.iterator, FooIteratorIterator = function() {
|
|
"use strict";
|
|
function FooIteratorIterator() {
|
|
_classCallCheck(this, FooIteratorIterator);
|
|
}
|
|
return _createClass(FooIteratorIterator, [
|
|
{
|
|
key: "next",
|
|
value: function() {
|
|
return {
|
|
value: new FooIterator,
|
|
done: !1
|
|
};
|
|
}
|
|
},
|
|
{
|
|
key: tmp1,
|
|
value: function() {
|
|
return this;
|
|
}
|
|
}
|
|
]), FooIteratorIterator;
|
|
}();
|