restructure classes transformer, fix class name inference - #1877

This commit is contained in:
Sebastian McKenzie
2015-06-30 14:49:04 +01:00
parent 092d98fb27
commit 336c65fe2c
12 changed files with 230 additions and 184 deletions

View File

@@ -11,7 +11,6 @@ var x = (function () {
4;
5;
6;
babelHelpers.classCallCheck(this, x);
}

View File

@@ -6,26 +6,22 @@ var BaseView = function BaseView() {
this.autoRender = true;
};
var BaseView = (function () {
var _class = function BaseView() {
babelHelpers.classCallCheck(this, _class);
var BaseView = function BaseView() {
babelHelpers.classCallCheck(this, BaseView);
this.autoRender = true;
};
return _class;
})();
this.autoRender = true;
};
var BaseView = (function () {
var _class2 = function BaseView() {
babelHelpers.classCallCheck(this, _class2);
};
function BaseView() {
babelHelpers.classCallCheck(this, BaseView);
}
babelHelpers.createClass(_class2, [{
babelHelpers.createClass(BaseView, [{
key: "foo",
value: function foo() {
this.autoRender = true;
}
}]);
return _class2;
return BaseView;
})();

View File

@@ -9,9 +9,9 @@ var TestEmpty = (function (_ref) {
babelHelpers.inherits(TestEmpty, _ref);
return TestEmpty;
})((function () {
var _class = function _class() {
function _class() {
babelHelpers.classCallCheck(this, _class);
};
}
return _class;
})());
@@ -25,9 +25,9 @@ var TestConstructorOnly = (function (_ref2) {
babelHelpers.inherits(TestConstructorOnly, _ref2);
return TestConstructorOnly;
})((function () {
var _class2 = function _class2() {
function _class2() {
babelHelpers.classCallCheck(this, _class2);
};
}
return _class2;
})());
@@ -41,9 +41,9 @@ var TestMethodOnly = (function (_ref3) {
babelHelpers.inherits(TestMethodOnly, _ref3);
return TestMethodOnly;
})((function () {
var _class3 = function _class3() {
function _class3() {
babelHelpers.classCallCheck(this, _class3);
};
}
babelHelpers.createClass(_class3, [{
key: "method",
@@ -61,9 +61,9 @@ var TestConstructorAndMethod = (function (_ref4) {
babelHelpers.inherits(TestConstructorAndMethod, _ref4);
return TestConstructorAndMethod;
})((function () {
var _class4 = function _class4() {
function _class4() {
babelHelpers.classCallCheck(this, _class4);
};
}
babelHelpers.createClass(_class4, [{
key: "method",
@@ -81,9 +81,9 @@ var TestMultipleMethods = (function (_ref5) {
babelHelpers.inherits(TestMultipleMethods, _ref5);
return TestMultipleMethods;
})((function () {
var _class5 = function _class5() {
function _class5() {
babelHelpers.classCallCheck(this, _class5);
};
}
babelHelpers.createClass(_class5, [{
key: "m1",

View File

@@ -9,13 +9,9 @@ define(["exports", "module"], function (exports, module) {
module.exports = function () {};
var _default = (function () {
var _class = function _default() {
babelHelpers.classCallCheck(this, _class);
};
return _class;
})();
var _default = function _default() {
babelHelpers.classCallCheck(this, _default);
};
module.exports = _default;

View File

@@ -11,13 +11,9 @@ exports["default"] = foo;
exports["default"] = function () {};
var _default = (function () {
var _class = function _default() {
babelHelpers.classCallCheck(this, _class);
};
return _class;
})();
var _default = function _default() {
babelHelpers.classCallCheck(this, _default);
};
exports["default"] = _default;

View File

@@ -2,13 +2,9 @@
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _default = (function () {
var _class = function _default() {
_classCallCheck(this, _class);
};
return _class;
})();
var _default = function _default() {
_classCallCheck(this, _default);
};
function foo() {}

View File

@@ -22,13 +22,9 @@ System.register([], function (_export) {
_export("default", function () {});
_default = (function () {
var _class = function _default() {
_classCallCheck(this, _class);
};
return _class;
})();
_default = function _default() {
_classCallCheck(this, _default);
};
_export("default", _default);
@@ -43,4 +39,4 @@ System.register([], function (_export) {
})());
}
};
});
});

View File

@@ -21,13 +21,9 @@
module.exports = function () {};
var _default = (function () {
var _class = function _default() {
babelHelpers.classCallCheck(this, _class);
};
return _class;
})();
var _default = function _default() {
babelHelpers.classCallCheck(this, _default);
};
module.exports = _default;

View File

@@ -14,14 +14,14 @@ var Foo = (function (_Bar) {
})(Bar);
var Foo2 = (function (_Bar2) {
var _class = function Foo2() {
babelHelpers.classCallCheck(this, _class2);
function Foo2() {
babelHelpers.classCallCheck(this, _Foo2);
babelHelpers.get(Object.getPrototypeOf(_class2.prototype), "constructor", this).call(this);
};
babelHelpers.get(Object.getPrototypeOf(_Foo2.prototype), "constructor", this).call(this);
}
babelHelpers.inherits(_class, _Bar2);
var _class2 = _class;
_class = bar(_class) || _class;
return _class;
})(Bar);
babelHelpers.inherits(Foo2, _Bar2);
var _Foo2 = Foo2;
Foo2 = bar(Foo2) || Foo2;
return Foo2;
})(Bar);