clean up classes output

This commit is contained in:
Sebastian McKenzie
2015-03-06 02:25:24 +11:00
parent 65998c3437
commit 7a6e568940
46 changed files with 263 additions and 367 deletions

View File

@@ -1,17 +1,20 @@
var genHelpers = require("./_generator-helpers");
var transform = require("../lib/babel/transformation");
var sourceMap = require("source-map");
var codeFrame = require("../lib/babel/helpers/code-frame");
var Module = require("module");
var helper = require("./_helper");
var assert = require("assert");
var chai = require("chai");
var path = require("path");
var util = require("../lib/babel/util");
var _ = require("lodash");
var genHelpers = require("./_generator-helpers");
var transform = require("../lib/babel/transformation");
var buildExernalHelpers = require("../lib/babel/build-external-helpers");
var sourceMap = require("source-map");
var codeFrame = require("../lib/babel/helpers/code-frame");
var Module = require("module");
var helper = require("./_helper");
var assert = require("assert");
var chai = require("chai");
var path = require("path");
var util = require("../lib/babel/util");
var _ = require("lodash");
require("../lib/babel/polyfill");
eval(buildExernalHelpers());
global.assertNoOwnProperties = function (obj) {
assert.equal(Object.getOwnPropertyNames(obj).length, 0);
};

View File

@@ -1,25 +1,16 @@
"use strict";
var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, "next"); var callThrow = step.bind(null, "throw"); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; };
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Foo = (function () {
function Foo() {
_classCallCheck(this, Foo);
babelHelpers.classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, {
babelHelpers.createClass(Foo, {
foo: {
value: _asyncToGenerator(function* () {
value: babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
}),
writable: true,
configurable: true
})
}
});
return Foo;
})();

View File

@@ -1,7 +1,5 @@
"use strict";
var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, "next"); var callThrow = step.bind(null, "throw"); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; };
var foo = _asyncToGenerator(function* () {
var foo = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
});

View File

@@ -1,4 +1,5 @@
{
"externalHelpers": true,
"noCheckAst": true,
"optional": ["asyncToGenerator"]
}

View File

@@ -1,7 +1,5 @@
"use strict";
var _asyncToGenerator = function (fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { var callNext = step.bind(null, "next"); var callThrow = step.bind(null, "throw"); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(callNext, callThrow); } } callNext(); }); }; };
var foo = _asyncToGenerator(function* () {
var foo = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
});

View File

@@ -2,7 +2,7 @@
var _bluebird = require("bluebird");
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -11,13 +11,11 @@ var Foo = (function () {
_classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, {
_createClass(Foo, {
foo: {
value: _bluebird.coroutine(function* () {
var wat = yield bar();
}),
writable: true,
configurable: true
})
}
});

View File

@@ -8,7 +8,7 @@ var obj = Object.defineProperties({}, {
set: function (value) {
this._foo = value;
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}
});
});

View File

@@ -5,7 +5,7 @@ var obj = Object.defineProperties({}, {
get: function () {
return 5 + 5;
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}
});
});

View File

@@ -5,7 +5,7 @@ var obj = Object.defineProperties({}, {
set: function (value) {
this._foo = value;
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}
});
});

View File

@@ -0,0 +1,9 @@
class Foo {
bar() {
return Foo;
}
}
var Bar = Foo;
Foo = 5;
assert.equal((new Bar).bar(), 5);

View File

@@ -0,0 +1,9 @@
var Foo = class Foo {
bar() {
return Foo;
}
}
var Bar = Foo;
Foo = 5;
assert.equal((new Bar).bar(), Bar);

View File

@@ -0,0 +1,11 @@
class Foo {
bar() {
return Foo;
}
}
var Bar = Foo;
Foo = 5;
assert.throws(function () {
Bar.call(6);
}, /Cannot call a class as a function/);

View File

@@ -1,45 +1,39 @@
"use strict";
var _slice = Array.prototype.slice;
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
var _Foo$prototype$test, _Foo$prototype$test2;
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
woops["super"].test();
Foo.call(this);
Foo.prototype.test.call(this);
Foo.call.apply(Foo, [this].concat(_slice.call(arguments)));
Foo.call.apply(Foo, [this, "test"].concat(_slice.call(arguments)));
Foo.call.apply(Foo, [this].concat(babelHelpers.slice.call(arguments)));
Foo.call.apply(Foo, [this, "test"].concat(babelHelpers.slice.call(arguments)));
(_Foo$prototype$test = Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(_slice.call(arguments)));
(_Foo$prototype$test2 = Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(_slice.call(arguments)));
(_Foo$prototype$test = Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(babelHelpers.slice.call(arguments)));
(_Foo$prototype$test2 = Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
Test.prototype.test = function test() {
var _Foo$prototype$test, _Foo$prototype$test2;
Foo.prototype.test.call(this);
(_Foo$prototype$test = Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(_slice.call(arguments)));
(_Foo$prototype$test2 = Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(_slice.call(arguments)));
(_Foo$prototype$test = Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(babelHelpers.slice.call(arguments)));
(_Foo$prototype$test2 = Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
};
Test.foo = function foo() {
var _Foo$foo, _Foo$foo2;
Foo.foo.call(this);
(_Foo$foo = Foo.foo).call.apply(_Foo$foo, [this].concat(_slice.call(arguments)));
(_Foo$foo2 = Foo.foo).call.apply(_Foo$foo2, [this, "test"].concat(_slice.call(arguments)));
(_Foo$foo = Foo.foo).call.apply(_Foo$foo, [this].concat(babelHelpers.slice.call(arguments)));
(_Foo$foo2 = Foo.foo).call.apply(_Foo$foo2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
};
return Test;
})(Foo);
})(Foo);

View File

@@ -1,18 +1,13 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
Foo.prototype.test;
Foo.prototype.test.whatever;
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
return Test;
})(Foo);

View File

@@ -1,18 +1,14 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
Foo.prototype.test.whatever();
Foo.prototype.test.call(this);
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
Test.test = function test() {
return Foo.wow.call(this);

View File

@@ -1,4 +1,5 @@
{
"externalHelpers": true,
"loose": ["es6.classes"],
"blacklist": ["es6.tailCall"]
}

View File

@@ -1,33 +1,27 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseController = (function (_Chaplin$Controller) {
function BaseController() {
_classCallCheck(this, BaseController);
babelHelpers.classCallCheck(this, BaseController);
if (_Chaplin$Controller != null) {
_Chaplin$Controller.apply(this, arguments);
}
}
_inherits(BaseController, _Chaplin$Controller);
babelHelpers.inherits(BaseController, _Chaplin$Controller);
return BaseController;
})(Chaplin.Controller);
var BaseController2 = (function (_Chaplin$Controller$Another) {
function BaseController2() {
_classCallCheck(this, BaseController2);
babelHelpers.classCallCheck(this, BaseController2);
if (_Chaplin$Controller$Another != null) {
_Chaplin$Controller$Another.apply(this, arguments);
}
}
_inherits(BaseController2, _Chaplin$Controller$Another);
babelHelpers.inherits(BaseController2, _Chaplin$Controller$Another);
return BaseController2;
})(Chaplin.Controller.Another);

View File

@@ -1,19 +1,14 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
if (Foo != null) {
Foo.apply(this, arguments);
}
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
return Test;
})(Foo);

View File

@@ -1,9 +1,7 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
Function.prototype.hasOwnProperty.call(this, "test");
};

View File

@@ -1,59 +1,43 @@
"use strict";
var _slice = Array.prototype.slice;
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
var _get2, _get3;
var _babelHelpers$get, _babelHelpers$get2;
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
woops["super"].test();
_get(Object.getPrototypeOf(Test.prototype), "constructor", this).call(this);
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "constructor", this).call(this);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
_get(Object.getPrototypeOf(Test.prototype), "constructor", this).apply(this, arguments);
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "constructor", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "constructor", this).apply(this, arguments);
(_babelHelpers$get = babelHelpers.get(Object.getPrototypeOf(Test.prototype), "constructor", this)).call.apply(_babelHelpers$get, [this, "test"].concat(babelHelpers.slice.call(arguments)));
_get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
(_get3 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get3, [this, "test"].concat(_slice.call(arguments)));
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
(_babelHelpers$get2 = babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_babelHelpers$get2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
}
_inherits(Test, Foo);
_prototypeProperties(Test, {
foo: {
value: function foo() {
var _get2;
_get(Object.getPrototypeOf(Test), "foo", this).call(this);
_get(Object.getPrototypeOf(Test), "foo", this).apply(this, arguments);
(_get2 = _get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
},
writable: true,
configurable: true
}
}, {
babelHelpers.inherits(Test, Foo);
babelHelpers.createClass(Test, {
test: {
value: function test() {
var _get2;
var _babelHelpers$get;
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
_get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
},
writable: true,
configurable: true
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
(_babelHelpers$get = babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_babelHelpers$get, [this, "test"].concat(babelHelpers.slice.call(arguments)));
}
}
}, {
foo: {
value: function foo() {
var _babelHelpers$get;
babelHelpers.get(Object.getPrototypeOf(Test), "foo", this).call(this);
babelHelpers.get(Object.getPrototypeOf(Test), "foo", this).apply(this, arguments);
(_babelHelpers$get = babelHelpers.get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_babelHelpers$get, [this, "test"].concat(babelHelpers.slice.call(arguments)));
}
}
});
return Test;
})(Foo);
})(Foo);

View File

@@ -1,20 +1,13 @@
"use strict";
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "test", this);
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever;
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).whatever;
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
return Test;
})(Foo);

View File

@@ -1,32 +1,20 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "test", this).whatever();
_get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).whatever();
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
}
_inherits(Test, Foo);
_prototypeProperties(Test, {
babelHelpers.inherits(Test, Foo);
babelHelpers.createClass(Test, null, {
test: {
value: function test() {
return _get(Object.getPrototypeOf(Test), "wow", this).call(this);
},
writable: true,
configurable: true
return babelHelpers.get(Object.getPrototypeOf(Test), "wow", this).call(this);
}
}
});
return Test;
})(Foo);

View File

@@ -1,23 +1,18 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
this.state = "test";
};
var Foo = (function (Bar) {
function Foo() {
_classCallCheck(this, Foo);
babelHelpers.classCallCheck(this, Foo);
this.state = "test";
}
_inherits(Foo, Bar);
babelHelpers.inherits(Foo, Bar);
return Foo;
})(Bar);

View File

@@ -1,25 +1,19 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
babelHelpers.createClass(Test, {
test: {
get: function () {
return 5 + 5;
},
set: function (val) {
this._test = val;
},
configurable: true
}
}
});
return Test;
})();

View File

@@ -1,22 +1,16 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
babelHelpers.createClass(Test, {
test: {
get: function () {
return 5 + 5;
},
configurable: true
}
}
});
return Test;
})();

View File

@@ -1,23 +1,16 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
babelHelpers.createClass(Test, {
test: {
value: function test() {
return 5 + 5;
},
writable: true,
configurable: true
}
}
});
return Test;
})();

View File

@@ -1,22 +1,16 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function () {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
babelHelpers.createClass(Test, {
test: {
set: function (val) {
this._test = val;
},
configurable: true
}
}
});
return Test;
})();

View File

@@ -0,0 +1,3 @@
{
"externalHelpers": true
}

View File

@@ -1,7 +1,5 @@
"use strict";
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
};

View File

@@ -1,35 +1,28 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseView = function BaseView() {
_classCallCheck(this, BaseView);
babelHelpers.classCallCheck(this, BaseView);
this.autoRender = true;
};
var BaseView = function BaseView() {
_classCallCheck(this, BaseView);
babelHelpers.classCallCheck(this, BaseView);
this.autoRender = true;
};
var BaseView = (function () {
function BaseView() {
_classCallCheck(this, BaseView);
babelHelpers.classCallCheck(this, BaseView);
}
_prototypeProperties(BaseView, null, {
babelHelpers.createClass(BaseView, {
foo: {
value: function foo() {
this.autoRender = true;
},
writable: true,
configurable: true
}
}
});
return BaseView;
})();

View File

@@ -1,26 +1,18 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var A = (function () {
function A() {
_classCallCheck(this, A);
babelHelpers.classCallCheck(this, A);
}
_prototypeProperties(A, {
babelHelpers.createClass(A, null, {
a: {
value: function a() {},
writable: true,
configurable: true
value: function a() {}
},
b: {
get: function () {},
set: function (b) {},
configurable: true
set: function (b) {}
}
});
return A;
})();
})();

View File

@@ -1,129 +1,106 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var TestEmpty = (function (_ref) {
function TestEmpty() {
_classCallCheck(this, TestEmpty);
babelHelpers.classCallCheck(this, TestEmpty);
if (_ref != null) {
_ref.apply(this, arguments);
}
}
_inherits(TestEmpty, _ref);
babelHelpers.inherits(TestEmpty, _ref);
return TestEmpty;
})(function _class() {
_classCallCheck(this, _class);
babelHelpers.classCallCheck(this, _class);
});
var TestConstructorOnly = (function (_ref2) {
function TestConstructorOnly() {
_classCallCheck(this, TestConstructorOnly);
babelHelpers.classCallCheck(this, TestConstructorOnly);
if (_ref2 != null) {
_ref2.apply(this, arguments);
}
}
_inherits(TestConstructorOnly, _ref2);
babelHelpers.inherits(TestConstructorOnly, _ref2);
return TestConstructorOnly;
})(function _class2() {
_classCallCheck(this, _class2);
babelHelpers.classCallCheck(this, _class2);
});
var TestMethodOnly = (function (_ref3) {
function TestMethodOnly() {
_classCallCheck(this, TestMethodOnly);
babelHelpers.classCallCheck(this, TestMethodOnly);
if (_ref3 != null) {
_ref3.apply(this, arguments);
}
}
_inherits(TestMethodOnly, _ref3);
babelHelpers.inherits(TestMethodOnly, _ref3);
return TestMethodOnly;
})((function () {
var _class3 = function () {
_classCallCheck(this, _class3);
babelHelpers.classCallCheck(this, _class3);
};
_prototypeProperties(_class3, null, {
babelHelpers.createClass(_class3, {
method: {
value: function method() {},
writable: true,
configurable: true
value: function method() {}
}
});
return _class3;
})());
var TestConstructorAndMethod = (function (_ref4) {
function TestConstructorAndMethod() {
_classCallCheck(this, TestConstructorAndMethod);
babelHelpers.classCallCheck(this, TestConstructorAndMethod);
if (_ref4 != null) {
_ref4.apply(this, arguments);
}
}
_inherits(TestConstructorAndMethod, _ref4);
babelHelpers.inherits(TestConstructorAndMethod, _ref4);
return TestConstructorAndMethod;
})((function () {
var _class4 = function () {
_classCallCheck(this, _class4);
babelHelpers.classCallCheck(this, _class4);
};
_prototypeProperties(_class4, null, {
babelHelpers.createClass(_class4, {
method: {
value: function method() {},
writable: true,
configurable: true
value: function method() {}
}
});
return _class4;
})());
var TestMultipleMethods = (function (_ref5) {
function TestMultipleMethods() {
_classCallCheck(this, TestMultipleMethods);
babelHelpers.classCallCheck(this, TestMultipleMethods);
if (_ref5 != null) {
_ref5.apply(this, arguments);
}
}
_inherits(TestMultipleMethods, _ref5);
babelHelpers.inherits(TestMultipleMethods, _ref5);
return TestMultipleMethods;
})((function () {
var _class5 = function () {
_classCallCheck(this, _class5);
babelHelpers.classCallCheck(this, _class5);
};
_prototypeProperties(_class5, null, {
babelHelpers.createClass(_class5, {
m1: {
value: function m1() {},
writable: true,
configurable: true
value: function m1() {}
},
m2: {
value: function m2() {},
writable: true,
configurable: true
value: function m2() {}
}
});
return _class5;
})());
})());

View File

@@ -1,33 +1,27 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var BaseController = (function (_Chaplin$Controller) {
function BaseController() {
_classCallCheck(this, BaseController);
babelHelpers.classCallCheck(this, BaseController);
if (_Chaplin$Controller != null) {
_Chaplin$Controller.apply(this, arguments);
}
}
_inherits(BaseController, _Chaplin$Controller);
babelHelpers.inherits(BaseController, _Chaplin$Controller);
return BaseController;
})(Chaplin.Controller);
var BaseController2 = (function (_Chaplin$Controller$Another) {
function BaseController2() {
_classCallCheck(this, BaseController2);
babelHelpers.classCallCheck(this, BaseController2);
if (_Chaplin$Controller$Another != null) {
_Chaplin$Controller$Another.apply(this, arguments);
}
}
_inherits(BaseController2, _Chaplin$Controller$Another);
babelHelpers.inherits(BaseController2, _Chaplin$Controller$Another);
return BaseController2;
})(Chaplin.Controller.Another);

View File

@@ -1,19 +1,14 @@
"use strict";
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = (function (Foo) {
function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
if (Foo != null) {
Foo.apply(this, arguments);
}
}
_inherits(Test, Foo);
babelHelpers.inherits(Test, Foo);
return Test;
})(Foo);

View File

@@ -1,11 +1,7 @@
"use strict";
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var Test = function Test() {
_classCallCheck(this, Test);
babelHelpers.classCallCheck(this, Test);
_get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
};

View File

@@ -11,8 +11,8 @@ var obj = Object.defineProperties({}, _defineProperty({}, x, {
set: function (value) {
valueSet = value;
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}));
obj.y = "foo";
obj.y === 1 && valueSet === "foo";

View File

@@ -1,45 +1,36 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); };
var Foo = (function () {
function Foo() {
_classCallCheck(this, Foo);
babelHelpers.classCallCheck(this, Foo);
}
_prototypeProperties(Foo, null, _defineProperty({
babelHelpers.createClass(Foo, babelHelpers.defineProperty({
bar: {
get: function () {
return _defineProperty(this, "bar", complex()).bar;
},
configurable: true
return babelHelpers.defineProperty(this, "bar", complex()).bar;
}
}
}, bar, {
get: function () {
return _defineProperty(this, bar, complex())[bar];
},
configurable: true
return babelHelpers.defineProperty(this, bar, complex())[bar];
}
}));
return Foo;
})();
var foo = Object.defineProperties({}, _defineProperty({
var foo = Object.defineProperties({}, babelHelpers.defineProperty({
bar: {
get: function () {
return _defineProperty(this, "bar", complex()).bar;
return babelHelpers.defineProperty(this, "bar", complex()).bar;
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}
}, bar, {
get: function () {
return _defineProperty(this, bar, complex())[bar];
return babelHelpers.defineProperty(this, bar, complex())[bar];
},
enumerable: true,
configurable: true
configurable: true,
enumerable: true
}));

View File

@@ -1,3 +1,4 @@
{
"externalHelpers": true,
"playground": true
}

View File

@@ -1,6 +1,6 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
@@ -9,12 +9,11 @@ var Test = (function () {
_classCallCheck(this, Test);
}
_prototypeProperties(Test, null, {
_createClass(Test, {
bar: {
get: function () {
throw new Error("wow");
},
configurable: true
}
}
});