Renamed files
This commit is contained in:
committed by
Nicolò Ribaudo
parent
07e69c009b
commit
0f42accb87
23
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js
vendored
Normal file
23
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/loose/output.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
var _gPO = Object.getPrototypeOf || function _gPO(o) { return o.__proto__; };
|
||||
|
||||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; return o; };
|
||||
|
||||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { var Constructor, a = [null]; a.push.apply(a, args); Constructor = Parent.bind.apply(Parent, a); return _sPO(new Constructor(), Class.prototype); };
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
|
||||
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, writeable: true, configurable: true } }); return _sPO(Wrapper, _sPO(function Super() { return _construct(Class, arguments, _gPO(this).constructor); }, Class)); }
|
||||
|
||||
var List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
_inheritsLoose(List, _Array);
|
||||
|
||||
function List() {
|
||||
return _Array.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
return List;
|
||||
}(_wrapNativeSuper(Array));
|
||||
16
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js
vendored
Normal file
16
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/shadowed/output.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
let Array = function Array() {
|
||||
babelHelpers.classCallCheck(this, Array);
|
||||
};
|
||||
|
||||
let List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
babelHelpers.inherits(List, _Array);
|
||||
|
||||
function List() {
|
||||
babelHelpers.classCallCheck(this, List);
|
||||
return babelHelpers.possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return List;
|
||||
}(Array);
|
||||
29
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js
vendored
Normal file
29
packages/babel-plugin-transform-classes/test/fixtures/extend-builtins/spec/output.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _gPO = Object.getPrototypeOf || function _gPO(o) { return o.__proto__; };
|
||||
|
||||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { o.__proto__ = p; return o; };
|
||||
|
||||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { var Constructor, a = [null]; a.push.apply(a, args); Constructor = Parent.bind.apply(Parent, a); return _sPO(new Constructor(), Class.prototype); };
|
||||
|
||||
var _cache = typeof Map === "function" && new Map();
|
||||
|
||||
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, writeable: true, configurable: true } }); return _sPO(Wrapper, _sPO(function Super() { return _construct(Class, arguments, _gPO(this).constructor); }, Class)); }
|
||||
|
||||
var List =
|
||||
/*#__PURE__*/
|
||||
function (_Array) {
|
||||
_inherits(List, _Array);
|
||||
|
||||
function List() {
|
||||
_classCallCheck(this, List);
|
||||
|
||||
return _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return List;
|
||||
}(_wrapNativeSuper(Array));
|
||||
1
packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/class/output.js
vendored
Normal file
1
packages/babel-plugin-transform-classes/test/fixtures/loose-classCallCheck/class/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
let A = function A() {};
|
||||
@@ -0,0 +1,17 @@
|
||||
let A = function A() {
|
||||
console.log('a');
|
||||
};
|
||||
|
||||
let B =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function B() {}
|
||||
|
||||
var _proto = B.prototype;
|
||||
|
||||
_proto.b = function b() {
|
||||
console.log('b');
|
||||
};
|
||||
|
||||
return B;
|
||||
}();
|
||||
@@ -0,0 +1,20 @@
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||||
|
||||
let B = function B() {};
|
||||
|
||||
let A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
_inheritsLoose(A, _B);
|
||||
|
||||
function A(track) {
|
||||
var _this;
|
||||
|
||||
if (track !== undefined) _this = _B.call(this, track) || this;else _this = _B.call(this) || this;
|
||||
return _assertThisInitialized(_this);
|
||||
}
|
||||
|
||||
return A;
|
||||
}(B);
|
||||
27
packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js
vendored
Normal file
27
packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-class/output.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _Foo$prototype$test, _Foo$prototype$test2;
|
||||
|
||||
var _this;
|
||||
|
||||
woops.super.test();
|
||||
_this = _Foo.call(this) || this;
|
||||
|
||||
_Foo.prototype.test.call(_this);
|
||||
|
||||
_this = _Foo.apply(this, arguments) || this;
|
||||
_this = _Foo.call.apply(_Foo, [this, "test"].concat(Array.prototype.slice.call(arguments))) || this;
|
||||
|
||||
(_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [_this].concat(Array.prototype.slice.call(arguments)));
|
||||
|
||||
(_Foo$prototype$test2 = _Foo.prototype.test).call.apply(_Foo$prototype$test2, [_this, "test"].concat(Array.prototype.slice.call(arguments)));
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
16
packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js
vendored
Normal file
16
packages/babel-plugin-transform-classes/test/fixtures/loose/accessing-super-properties/output.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _this;
|
||||
|
||||
_this = _Foo.call(this) || this;
|
||||
_Foo.prototype.test;
|
||||
_Foo.prototype.test.whatever;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
23
packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js
vendored
Normal file
23
packages/babel-plugin-transform-classes/test/fixtures/loose/calling-super-properties/output.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _this;
|
||||
|
||||
_this = _Foo.call(this) || this;
|
||||
|
||||
_Foo.prototype.test.whatever();
|
||||
|
||||
_Foo.prototype.test.call(_this);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
Test.test = function test() {
|
||||
return _Foo.wow.call(this);
|
||||
};
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
19
packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js
vendored
Normal file
19
packages/babel-plugin-transform-classes/test/fixtures/loose/constructor-order/output.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
var x =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var _proto = x.prototype;
|
||||
|
||||
_proto.f = function f() {
|
||||
1;
|
||||
2;
|
||||
3;
|
||||
};
|
||||
|
||||
function x() {
|
||||
4;
|
||||
5;
|
||||
6;
|
||||
}
|
||||
|
||||
return x;
|
||||
}();
|
||||
@@ -0,0 +1,13 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inheritsLoose(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
return babelHelpers.assertThisInitialized(_this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,13 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
babelHelpers.inheritsLoose(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
return false || babelHelpers.assertThisInitialized(_this);
|
||||
}
|
||||
|
||||
return Child;
|
||||
}(Base);
|
||||
@@ -0,0 +1,13 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
babelHelpers.inheritsLoose(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
return {} || babelHelpers.assertThisInitialized(_this);
|
||||
}
|
||||
|
||||
return Child;
|
||||
}(Base);
|
||||
11
packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js
vendored
Normal file
11
packages/babel-plugin-transform-classes/test/fixtures/loose/literal-key/output.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo() {}
|
||||
|
||||
var _proto = Foo.prototype;
|
||||
|
||||
_proto["bar"] = function bar() {};
|
||||
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,14 @@
|
||||
// @flow
|
||||
var C =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function C() {}
|
||||
|
||||
var _proto = C.prototype;
|
||||
|
||||
_proto.m = function m(x: number): string {
|
||||
return 'a';
|
||||
};
|
||||
|
||||
return C;
|
||||
}();
|
||||
15
packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js
vendored
Normal file
15
packages/babel-plugin-transform-classes/test/fixtures/loose/method-reuse-prototype/output.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Test() {}
|
||||
|
||||
var _proto = Test.prototype;
|
||||
|
||||
_proto.a = function a() {};
|
||||
|
||||
Test.b = function b() {};
|
||||
|
||||
_proto.c = function c() {};
|
||||
|
||||
return Test;
|
||||
}();
|
||||
@@ -0,0 +1,23 @@
|
||||
var BaseController =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller) {
|
||||
babelHelpers.inheritsLoose(BaseController, _Chaplin$Controller);
|
||||
|
||||
function BaseController() {
|
||||
return _Chaplin$Controller.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
return BaseController;
|
||||
}(Chaplin.Controller);
|
||||
|
||||
var BaseController2 =
|
||||
/*#__PURE__*/
|
||||
function (_Chaplin$Controller$A) {
|
||||
babelHelpers.inheritsLoose(BaseController2, _Chaplin$Controller$A);
|
||||
|
||||
function BaseController2() {
|
||||
return _Chaplin$Controller$A.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
return BaseController2;
|
||||
}(Chaplin.Controller.Another);
|
||||
11
packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js
vendored
Normal file
11
packages/babel-plugin-transform-classes/test/fixtures/loose/super-class/output.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inheritsLoose(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
return _Foo.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
@@ -0,0 +1,3 @@
|
||||
var Test = function Test() {
|
||||
Function.prototype.hasOwnProperty.call(this, "test");
|
||||
};
|
||||
45
packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js
vendored
Normal file
45
packages/babel-plugin-transform-classes/test/fixtures/regression/2663/output.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _net = babelHelpers.interopRequireDefault(require("net"));
|
||||
|
||||
var _events = require("events");
|
||||
|
||||
var _binarySerializer = babelHelpers.interopRequireDefault(require("./helpers/binary-serializer"));
|
||||
|
||||
// import ...
|
||||
var Connection =
|
||||
/*#__PURE__*/
|
||||
function (_EventEmitter) {
|
||||
babelHelpers.inherits(Connection, _EventEmitter);
|
||||
|
||||
function Connection(endpoint, joinKey, joinData, roomId) {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Connection);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Connection.__proto__ || Object.getPrototypeOf(Connection)).call(this));
|
||||
_this.isConnected = false;
|
||||
_this.roomId = roomId; // ...
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Connection, [{
|
||||
key: "send",
|
||||
value: function send(message) {
|
||||
this.sock.write(_binarySerializer.default.serializeMessage(message));
|
||||
}
|
||||
}, {
|
||||
key: "disconnect",
|
||||
value: function disconnect() {
|
||||
this.sock.close();
|
||||
}
|
||||
}]);
|
||||
return Connection;
|
||||
}(_events.EventEmitter);
|
||||
|
||||
exports.default = Connection;
|
||||
30
packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js
vendored
Normal file
30
packages/babel-plugin-transform-classes/test/fixtures/regression/2694/output.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _BaseFoo2 = babelHelpers.interopRequireDefault(require("./BaseFoo"));
|
||||
|
||||
var SubFoo =
|
||||
/*#__PURE__*/
|
||||
function (_BaseFoo) {
|
||||
babelHelpers.inherits(SubFoo, _BaseFoo);
|
||||
|
||||
function SubFoo() {
|
||||
babelHelpers.classCallCheck(this, SubFoo);
|
||||
return babelHelpers.possibleConstructorReturn(this, (SubFoo.__proto__ || Object.getPrototypeOf(SubFoo)).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.createClass(SubFoo, null, [{
|
||||
key: "talk",
|
||||
value: function talk() {
|
||||
babelHelpers.get(SubFoo.__proto__ || Object.getPrototypeOf(SubFoo), "talk", this).call(this);
|
||||
console.log('SubFoo.talk');
|
||||
}
|
||||
}]);
|
||||
return SubFoo;
|
||||
}(_BaseFoo2.default);
|
||||
|
||||
exports.default = SubFoo;
|
||||
31
packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js
vendored
Normal file
31
packages/babel-plugin-transform-classes/test/fixtures/regression/2775/output.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = babelHelpers.interopRequireWildcard(require("react"));
|
||||
|
||||
var RandomComponent =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
babelHelpers.inherits(RandomComponent, _Component);
|
||||
|
||||
function RandomComponent() {
|
||||
babelHelpers.classCallCheck(this, RandomComponent);
|
||||
return babelHelpers.possibleConstructorReturn(this, (RandomComponent.__proto__ || Object.getPrototypeOf(RandomComponent)).call(this));
|
||||
}
|
||||
|
||||
babelHelpers.createClass(RandomComponent, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return _react.default.createElement("div", {
|
||||
className: "sui-RandomComponent"
|
||||
}, _react.default.createElement("h2", null, "Hi there!"));
|
||||
}
|
||||
}]);
|
||||
return RandomComponent;
|
||||
}(_react.Component);
|
||||
|
||||
exports.default = RandomComponent;
|
||||
12
packages/babel-plugin-transform-classes/test/fixtures/regression/2941/output.js
vendored
Normal file
12
packages/babel-plugin-transform-classes/test/fixtures/regression/2941/output.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _class = function _class() {
|
||||
babelHelpers.classCallCheck(this, _class);
|
||||
};
|
||||
|
||||
exports.default = _class;
|
||||
54
packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js
vendored
Normal file
54
packages/babel-plugin-transform-classes/test/fixtures/regression/3028/output.js
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var b = function b() {
|
||||
babelHelpers.classCallCheck(this, b);
|
||||
};
|
||||
|
||||
var a1 =
|
||||
/*#__PURE__*/
|
||||
function (_b) {
|
||||
babelHelpers.inherits(a1, _b);
|
||||
|
||||
function a1() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, a1);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (a1.__proto__ || Object.getPrototypeOf(a1)).call(this));
|
||||
|
||||
_this.x = function () {
|
||||
return babelHelpers.assertThisInitialized(_this);
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return a1;
|
||||
}(b);
|
||||
|
||||
var a2 =
|
||||
/*#__PURE__*/
|
||||
function (_b2) {
|
||||
babelHelpers.inherits(a2, _b2);
|
||||
|
||||
function a2() {
|
||||
var _this2;
|
||||
|
||||
babelHelpers.classCallCheck(this, a2);
|
||||
_this2 = babelHelpers.possibleConstructorReturn(this, (a2.__proto__ || Object.getPrototypeOf(a2)).call(this));
|
||||
|
||||
_this2.x = function () {
|
||||
return babelHelpers.assertThisInitialized(_this2);
|
||||
};
|
||||
|
||||
return _this2;
|
||||
}
|
||||
|
||||
return a2;
|
||||
}(b);
|
||||
|
||||
exports.default = a2;
|
||||
24
packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js
vendored
Normal file
24
packages/babel-plugin-transform-classes/test/fixtures/regression/5817/output.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
babelHelpers.inherits(A, _B);
|
||||
|
||||
function A() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
|
||||
|
||||
_this.arrow1 = function (x) {
|
||||
return x;
|
||||
};
|
||||
|
||||
_this.arrow2 = function (x) {
|
||||
return x;
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
return A;
|
||||
}(B);
|
||||
14
packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js
vendored
Normal file
14
packages/babel-plugin-transform-classes/test/fixtures/regression/T2494/output.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var x = {
|
||||
Foo:
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inherits(_class, _Foo);
|
||||
|
||||
function _class() {
|
||||
babelHelpers.classCallCheck(this, _class);
|
||||
return babelHelpers.possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return _class;
|
||||
}(Foo)
|
||||
};
|
||||
18
packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js
vendored
Normal file
18
packages/babel-plugin-transform-classes/test/fixtures/regression/T2997/output.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var A = function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
};
|
||||
|
||||
var B =
|
||||
/*#__PURE__*/
|
||||
function (_A) {
|
||||
babelHelpers.inherits(B, _A);
|
||||
|
||||
function B() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, B);
|
||||
return babelHelpers.possibleConstructorReturn(_this, _this = babelHelpers.possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this)));
|
||||
}
|
||||
|
||||
return B;
|
||||
}(A);
|
||||
15
packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js
vendored
Normal file
15
packages/babel-plugin-transform-classes/test/fixtures/regression/T6712/output.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(A, [{
|
||||
key: "foo",
|
||||
value: function foo() {
|
||||
var foo = 2;
|
||||
}
|
||||
}]);
|
||||
return A;
|
||||
}();
|
||||
23
packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js
vendored
Normal file
23
packages/babel-plugin-transform-classes/test/fixtures/regression/T6750/output.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _default() {
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Select() {
|
||||
babelHelpers.classCallCheck(this, Select);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Select, [{
|
||||
key: "query",
|
||||
value: function query(_query) {}
|
||||
}]);
|
||||
return Select;
|
||||
}()
|
||||
);
|
||||
}
|
||||
30
packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js
vendored
Normal file
30
packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var Example =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Example() {}
|
||||
|
||||
var _proto = Example.prototype;
|
||||
|
||||
_proto.test1 = async function test1() {
|
||||
await Promise.resolve(2);
|
||||
};
|
||||
|
||||
_proto.test2 =
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function test2() {
|
||||
return regeneratorRuntime.wrap(function test2$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.next = 2;
|
||||
return 3;
|
||||
|
||||
case 2:
|
||||
case "end":
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, test2, this);
|
||||
});
|
||||
return Example;
|
||||
}();
|
||||
26
packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js
vendored
Normal file
26
packages/babel-plugin-transform-classes/test/fixtures/regression/T7010/output.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo(val) {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this._val = val;
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "foo2",
|
||||
value: function (_foo) {
|
||||
function foo2() {
|
||||
return _foo.apply(this, arguments);
|
||||
}
|
||||
|
||||
foo2.toString = function () {
|
||||
return _foo.toString();
|
||||
};
|
||||
|
||||
return foo2;
|
||||
}(function () {
|
||||
return foo2(this._val);
|
||||
})
|
||||
}]);
|
||||
return Foo;
|
||||
}();
|
||||
30
packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js
vendored
Normal file
30
packages/babel-plugin-transform-classes/test/fixtures/regression/T7537/output.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var B = function B() {
|
||||
_classCallCheck(this, B);
|
||||
};
|
||||
|
||||
var A =
|
||||
/*#__PURE__*/
|
||||
function (_B) {
|
||||
_inherits(A, _B);
|
||||
|
||||
function A(track) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, A);
|
||||
|
||||
if (track !== undefined) _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this, track));else _this = _possibleConstructorReturn(this, (A.__proto__ || Object.getPrototypeOf(A)).call(this));
|
||||
return _possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
return A;
|
||||
}(B);
|
||||
46
packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js
vendored
Normal file
46
packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-class/output.js
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _ref, _babelHelpers$get;
|
||||
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
woops.super.test();
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(_this);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).apply(this, arguments));
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (_ref = Test.__proto__ || Object.getPrototypeOf(Test)).call.apply(_ref, [this, "test"].concat(Array.prototype.slice.call(arguments))));
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).apply(_this, arguments);
|
||||
|
||||
(_babelHelpers$get = babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this))).call.apply(_babelHelpers$get, [_this, "test"].concat(Array.prototype.slice.call(arguments)));
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Test, [{
|
||||
key: "test",
|
||||
value: function test() {
|
||||
var _babelHelpers$get2;
|
||||
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
|
||||
|
||||
(_babelHelpers$get2 = babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_babelHelpers$get2, [this, "test"].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
}], [{
|
||||
key: "foo",
|
||||
value: function foo() {
|
||||
var _babelHelpers$get3;
|
||||
|
||||
babelHelpers.get(Test.__proto__ || Object.getPrototypeOf(Test), "foo", this).call(this);
|
||||
babelHelpers.get(Test.__proto__ || Object.getPrototypeOf(Test), "foo", this).apply(this, arguments);
|
||||
|
||||
(_babelHelpers$get3 = babelHelpers.get(Test.__proto__ || Object.getPrototypeOf(Test), "foo", this)).call.apply(_babelHelpers$get3, [this, "test"].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
}]);
|
||||
return Test;
|
||||
}(Foo);
|
||||
17
packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js
vendored
Normal file
17
packages/babel-plugin-transform-classes/test/fixtures/spec/accessing-super-properties/output.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this));
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Test;
|
||||
}(Foo);
|
||||
23
packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js
vendored
Normal file
23
packages/babel-plugin-transform-classes/test/fixtures/spec/calling-super-properties/output.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function (_Foo) {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
function Test() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Test.__proto__ || Object.getPrototypeOf(Test)).call(this));
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).whatever();
|
||||
babelHelpers.get(Test.prototype.__proto__ || Object.getPrototypeOf(Test.prototype), "test", babelHelpers.assertThisInitialized(_this)).call(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Test, null, [{
|
||||
key: "test",
|
||||
value: function test() {
|
||||
return babelHelpers.get(Test.__proto__ || Object.getPrototypeOf(Test), "wow", this).call(this);
|
||||
}
|
||||
}]);
|
||||
return Test;
|
||||
}(Foo);
|
||||
22
packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js
vendored
Normal file
22
packages/babel-plugin-transform-classes/test/fixtures/spec/computed-methods/output.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "foo",
|
||||
value: function foo() {}
|
||||
}, {
|
||||
key: "foo",
|
||||
value: function foo() {}
|
||||
}, {
|
||||
key: bar,
|
||||
value: function value() {}
|
||||
}, {
|
||||
key: bar + "foo",
|
||||
value: function value() {}
|
||||
}]);
|
||||
return Foo;
|
||||
}();
|
||||
@@ -0,0 +1,7 @@
|
||||
var Example = function Example() {
|
||||
babelHelpers.classCallCheck(this, Example);
|
||||
|
||||
var _Example;
|
||||
};
|
||||
|
||||
var t = new Example();
|
||||
29
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js
vendored
Normal file
29
packages/babel-plugin-transform-classes/test/fixtures/spec/constructor/output.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
this.state = "test";
|
||||
};
|
||||
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
_this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
|
||||
_this.state = "test";
|
||||
return _this;
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
|
||||
var ConstructorScoping = function ConstructorScoping() {
|
||||
babelHelpers.classCallCheck(this, ConstructorScoping);
|
||||
var bar;
|
||||
{
|
||||
var _bar;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
return _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this, () => {
|
||||
_this.test;
|
||||
}));
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,15 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
if (eval("false")) _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,18 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
var fn = () => _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
|
||||
|
||||
fn();
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,17 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
var fn = () => _this = babelHelpers.possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).call(this));
|
||||
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,14 @@
|
||||
var Foo =
|
||||
/*#__PURE__*/
|
||||
function (_Bar) {
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
|
||||
function Foo() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
return babelHelpers.possibleConstructorReturn(_this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
}(Bar);
|
||||
@@ -0,0 +1,14 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
babelHelpers.inherits(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Child);
|
||||
return babelHelpers.possibleConstructorReturn(_this, false);
|
||||
}
|
||||
|
||||
return Child;
|
||||
}(Base);
|
||||
@@ -0,0 +1,14 @@
|
||||
var Child =
|
||||
/*#__PURE__*/
|
||||
function (_Base) {
|
||||
babelHelpers.inherits(Child, _Base);
|
||||
|
||||
function Child() {
|
||||
var _this;
|
||||
|
||||
babelHelpers.classCallCheck(this, Child);
|
||||
return babelHelpers.possibleConstructorReturn(_this, {});
|
||||
}
|
||||
|
||||
return Child;
|
||||
}(Base);
|
||||
5
packages/babel-plugin-transform-classes/test/fixtures/spec/export-default/output.js
vendored
Normal file
5
packages/babel-plugin-transform-classes/test/fixtures/spec/export-default/output.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
export { Foo as default };
|
||||
14
packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.js
vendored
Normal file
14
packages/babel-plugin-transform-classes/test/fixtures/spec/export-super-class/output.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var _class =
|
||||
/*#__PURE__*/
|
||||
function (_A) {
|
||||
babelHelpers.inherits(_class, _A);
|
||||
|
||||
function _class() {
|
||||
babelHelpers.classCallCheck(this, _class);
|
||||
return babelHelpers.possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return _class;
|
||||
}(A);
|
||||
|
||||
export { _class as default };
|
||||
@@ -0,0 +1,5 @@
|
||||
var o = {
|
||||
foo: function foo() {
|
||||
babelHelpers.classCallCheck(this, foo);
|
||||
}
|
||||
};
|
||||
18
packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js
vendored
Normal file
18
packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter-and-setter/output.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Test, [{
|
||||
key: "test",
|
||||
get: function get() {
|
||||
return 5 + 5;
|
||||
},
|
||||
set: function set(val) {
|
||||
this._test = val;
|
||||
}
|
||||
}]);
|
||||
return Test;
|
||||
}();
|
||||
15
packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js
vendored
Normal file
15
packages/babel-plugin-transform-classes/test/fixtures/spec/instance-getter/output.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var Test =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Test, [{
|
||||
key: "test",
|
||||
get: function get() {
|
||||
return 5 + 5;
|
||||
}
|
||||
}]);
|
||||
return Test;
|
||||
}();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user