class declarations also have a lexical self binding
This commit is contained in:
parent
7d446807a9
commit
51e336b037
@ -9,14 +9,28 @@ import t from "../../../types";
|
||||
export var check = t.isClass;
|
||||
|
||||
export function ClassDeclaration(node, parent, scope, file) {
|
||||
return new ClassTransformer(node, parent, scope, file, true).run();
|
||||
return t.variableDeclaration("let", [
|
||||
t.variableDeclarator(node.id, t.toExpression(node))
|
||||
]);
|
||||
}
|
||||
|
||||
export function ClassExpression(node, parent, scope, file) {
|
||||
return new ClassTransformer(node, parent, scope, file, false).run();
|
||||
return new ClassTransformer(node, parent, scope, file).run();
|
||||
}
|
||||
|
||||
var verifyConstructorVisitor = {
|
||||
var verifyConstructorVisitor = traverse.explode({
|
||||
MethodDefinition: {
|
||||
enter() {
|
||||
this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
Property: {
|
||||
enter(node) {
|
||||
if (node.method) this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
CallExpression: {
|
||||
enter(node, parent, scope, state) {
|
||||
if (t.isIdentifier(node.callee, { name: "super" })) {
|
||||
@ -36,7 +50,7 @@ var verifyConstructorVisitor = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
class ClassTransformer {
|
||||
|
||||
@ -47,15 +61,13 @@ class ClassTransformer {
|
||||
* @param {Node} parent
|
||||
* @param {Scope} scope
|
||||
* @param {File} file
|
||||
* @param {Boolean} isStatement
|
||||
*/
|
||||
|
||||
constructor(node, parent, scope, file, isStatement) {
|
||||
this.isStatement = isStatement;
|
||||
this.parent = parent;
|
||||
this.scope = scope;
|
||||
this.node = node;
|
||||
this.file = file;
|
||||
constructor(node, parent, scope, file) {
|
||||
this.parent = parent;
|
||||
this.scope = scope;
|
||||
this.node = node;
|
||||
this.file = file;
|
||||
|
||||
this.hasInstanceMutators = false;
|
||||
this.hasStaticMutators = false;
|
||||
@ -65,7 +77,7 @@ class ClassTransformer {
|
||||
|
||||
this.hasConstructor = false;
|
||||
this.className = node.id;
|
||||
this.classRef = scope.generateUidIdentifier(node.id ? node.id.name : "class");
|
||||
this.classRef = node.id || scope.generateUidIdentifier("class");
|
||||
|
||||
this.superName = node.superClass || t.identifier("Function");
|
||||
this.hasSuper = !!node.superClass;
|
||||
@ -92,17 +104,6 @@ class ClassTransformer {
|
||||
|
||||
//
|
||||
|
||||
var useFunctionDeclaration = false;
|
||||
|
||||
// class expressions have their class id lexically bound
|
||||
|
||||
if (!this.isStatement && this.className) {
|
||||
useFunctionDeclaration = true;
|
||||
classRef = this.classRef = this.className || this.classRef;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
var constructorBody = t.blockStatement([
|
||||
t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [
|
||||
t.thisExpression(),
|
||||
@ -112,8 +113,8 @@ class ClassTransformer {
|
||||
|
||||
var constructor;
|
||||
|
||||
if (useFunctionDeclaration) {
|
||||
constructor = t.functionDeclaration(classRef, [], constructorBody);
|
||||
if (this.className) {
|
||||
constructor = t.functionDeclaration(this.className, [], constructorBody);
|
||||
body.push(constructor);
|
||||
} else {
|
||||
constructor = t.functionExpression(null, [], constructorBody);
|
||||
@ -142,13 +143,10 @@ class ClassTransformer {
|
||||
|
||||
this.buildBody();
|
||||
|
||||
if (!useFunctionDeclaration) {
|
||||
if (this.isStatement) {
|
||||
constructor = nameMethod.custom(constructor, this.className, this.scope);
|
||||
} else if (!this.className) {
|
||||
// infer class name if this is a nameless class expression
|
||||
constructor = nameMethod.bare(constructor, this.parent, this.scope);
|
||||
}
|
||||
// infer class name if this is a nameless class expression
|
||||
|
||||
if (!this.className) {
|
||||
constructor = nameMethod.bare(constructor, this.parent, this.scope);
|
||||
|
||||
body.unshift(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(classRef, constructor)
|
||||
@ -161,18 +159,10 @@ class ClassTransformer {
|
||||
|
||||
body.push(t.returnStatement(classRef));
|
||||
|
||||
var init = t.callExpression(
|
||||
return t.callExpression(
|
||||
t.functionExpression(null, closureParams, t.blockStatement(body)),
|
||||
closureArgs
|
||||
);
|
||||
|
||||
if (this.isStatement) {
|
||||
return t.variableDeclaration("let", [
|
||||
t.variableDeclarator(this.className, init)
|
||||
]);
|
||||
} else {
|
||||
return init;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,6 +247,8 @@ class ClassTransformer {
|
||||
*/
|
||||
|
||||
verifyConstructor(node) {
|
||||
return; // enable this for the next major
|
||||
|
||||
var state = {
|
||||
hasBareSuper: false,
|
||||
hasSuper: this.hasSuper,
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
_classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
arr.map(x => x * x);
|
||||
};
|
||||
}
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,16 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Foo, {
|
||||
babelHelpers.createClass(Foo, {
|
||||
foo: {
|
||||
value: babelHelpers.asyncToGenerator(function* () {
|
||||
var wat = yield bar();
|
||||
})
|
||||
}
|
||||
});
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
@ -7,11 +7,11 @@ var _createClass = (function () { function defineProperties(target, props) { for
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
_createClass(_Foo, {
|
||||
_createClass(Foo, {
|
||||
foo: {
|
||||
value: _bluebird.coroutine(function* () {
|
||||
var wat = yield bar();
|
||||
@ -19,5 +19,5 @@ var Foo = (function () {
|
||||
}
|
||||
});
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
@ -6,4 +6,4 @@ class Foo {
|
||||
|
||||
var Bar = Foo;
|
||||
Foo = 5;
|
||||
assert.equal((new Bar).bar(), 5);
|
||||
assert.equal((new Bar).bar(), Bar);
|
||||
@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
function Test() {
|
||||
var _Foo$prototype$test, _Foo$prototype$test2;
|
||||
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
woops["super"].test();
|
||||
_Foo.call(this);
|
||||
@ -15,11 +15,11 @@ var Test = (function (_Foo) {
|
||||
|
||||
(_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)));
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
_Test.prototype.test = function test() {
|
||||
Test.prototype.test = function test() {
|
||||
var _Foo$prototype$test, _Foo$prototype$test2;
|
||||
|
||||
_Foo.prototype.test.call(this);
|
||||
@ -27,7 +27,7 @@ var Test = (function (_Foo) {
|
||||
(_Foo$prototype$test2 = _Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
};
|
||||
|
||||
_Test.foo = function foo() {
|
||||
Test.foo = function foo() {
|
||||
var _Foo$foo, _Foo$foo2;
|
||||
|
||||
_Foo.foo.call(this);
|
||||
@ -35,5 +35,5 @@ var Test = (function (_Foo) {
|
||||
(_Foo$foo2 = _Foo.foo).call.apply(_Foo$foo2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
};
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
_Foo.call(this);
|
||||
_Foo.prototype.test;
|
||||
_Foo.prototype.test.whatever;
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
return _Test;
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
_Foo.call(this);
|
||||
_Foo.prototype.test.whatever();
|
||||
_Foo.prototype.test.call(this);
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
_Test.test = function test() {
|
||||
Test.test = function test() {
|
||||
return _Foo.wow.call(this);
|
||||
};
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,27 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
var BaseController = (function (_Chaplin$Controller) {
|
||||
var _BaseController = function BaseController() {
|
||||
babelHelpers.classCallCheck(this, _BaseController);
|
||||
function BaseController() {
|
||||
babelHelpers.classCallCheck(this, BaseController);
|
||||
|
||||
if (_Chaplin$Controller != null) {
|
||||
_Chaplin$Controller.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_BaseController, _Chaplin$Controller);
|
||||
return _BaseController;
|
||||
babelHelpers.inherits(BaseController, _Chaplin$Controller);
|
||||
return BaseController;
|
||||
})(Chaplin.Controller);
|
||||
|
||||
var BaseController2 = (function (_Chaplin$Controller$Another) {
|
||||
var _BaseController2 = function BaseController2() {
|
||||
babelHelpers.classCallCheck(this, _BaseController2);
|
||||
function BaseController2() {
|
||||
babelHelpers.classCallCheck(this, BaseController2);
|
||||
|
||||
if (_Chaplin$Controller$Another != null) {
|
||||
_Chaplin$Controller$Another.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_BaseController2, _Chaplin$Controller$Another);
|
||||
return _BaseController2;
|
||||
babelHelpers.inherits(BaseController2, _Chaplin$Controller$Another);
|
||||
return BaseController2;
|
||||
})(Chaplin.Controller.Another);
|
||||
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
if (_Foo != null) {
|
||||
_Foo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
return _Test;
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
Function.prototype.hasOwnProperty.call(this, "test");
|
||||
};
|
||||
}
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
10
test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js
vendored
Normal file
10
test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this);
|
||||
}
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
this.foo = "bar";
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@ -1,31 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
function Test() {
|
||||
var _babelHelpers$get, _babelHelpers$get2;
|
||||
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
woops["super"].test();
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "constructor", this).call(this);
|
||||
babelHelpers.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);
|
||||
|
||||
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)));
|
||||
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)));
|
||||
|
||||
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)));
|
||||
};
|
||||
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)));
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
babelHelpers.createClass(_Test, {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
babelHelpers.createClass(Test, {
|
||||
test: {
|
||||
value: function test() {
|
||||
var _babelHelpers$get;
|
||||
|
||||
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)));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
@ -33,11 +33,11 @@ var Test = (function (_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)));
|
||||
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);
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "constructor", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "test", this);
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "test", this).whatever;
|
||||
};
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "constructor", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this);
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).whatever;
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
return _Test;
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,21 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "constructor", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "test", this).whatever();
|
||||
babelHelpers.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).whatever();
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
babelHelpers.createClass(_Test, null, {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
babelHelpers.createClass(Test, null, {
|
||||
test: {
|
||||
value: function test() {
|
||||
return babelHelpers.get(Object.getPrototypeOf(_Test), "wow", this).call(this);
|
||||
return babelHelpers.get(Object.getPrototypeOf(Test), "wow", this).call(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
return _Test;
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,23 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
this.state = "test";
|
||||
};
|
||||
}
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
var _Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(_Foo.prototype), "constructor", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this);
|
||||
this.state = "test";
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Foo, _Bar);
|
||||
return _Foo;
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Test, {
|
||||
babelHelpers.createClass(Test, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
@ -15,5 +15,5 @@ var Test = (function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,16 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Test, {
|
||||
babelHelpers.createClass(Test, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
}
|
||||
}
|
||||
});
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,16 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Test, {
|
||||
babelHelpers.createClass(Test, {
|
||||
test: {
|
||||
value: function test() {
|
||||
return 5 + 5;
|
||||
}
|
||||
}
|
||||
});
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,16 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Test, {
|
||||
babelHelpers.createClass(Test, {
|
||||
test: {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
}
|
||||
}
|
||||
});
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,9 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var A = (function () {
|
||||
var _A = function A() {
|
||||
babelHelpers.classCallCheck(this, _A);
|
||||
};
|
||||
function A() {
|
||||
babelHelpers.classCallCheck(this, A);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_A, null, {
|
||||
babelHelpers.createClass(A, null, {
|
||||
a: {
|
||||
value: function a() {}
|
||||
},
|
||||
@ -14,5 +14,5 @@ var A = (function () {
|
||||
set: function (b) {}
|
||||
}
|
||||
});
|
||||
return _A;
|
||||
return A;
|
||||
})();
|
||||
@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(_Foo.prototype), "constructor", this).call(this);
|
||||
};
|
||||
|
||||
return _Foo;
|
||||
})();
|
||||
@ -1,16 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var TestEmpty = (function (_ref) {
|
||||
var _TestEmpty = function TestEmpty() {
|
||||
babelHelpers.classCallCheck(this, _TestEmpty);
|
||||
function TestEmpty() {
|
||||
babelHelpers.classCallCheck(this, TestEmpty);
|
||||
|
||||
if (_ref != null) {
|
||||
_ref.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_TestEmpty, _ref);
|
||||
return _TestEmpty;
|
||||
babelHelpers.inherits(TestEmpty, _ref);
|
||||
return TestEmpty;
|
||||
})((function () {
|
||||
var _class = function () {
|
||||
babelHelpers.classCallCheck(this, _class);
|
||||
@ -20,16 +20,16 @@ var TestEmpty = (function (_ref) {
|
||||
})());
|
||||
|
||||
var TestConstructorOnly = (function (_ref2) {
|
||||
var _TestConstructorOnly = function TestConstructorOnly() {
|
||||
babelHelpers.classCallCheck(this, _TestConstructorOnly);
|
||||
function TestConstructorOnly() {
|
||||
babelHelpers.classCallCheck(this, TestConstructorOnly);
|
||||
|
||||
if (_ref2 != null) {
|
||||
_ref2.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_TestConstructorOnly, _ref2);
|
||||
return _TestConstructorOnly;
|
||||
babelHelpers.inherits(TestConstructorOnly, _ref2);
|
||||
return TestConstructorOnly;
|
||||
})((function () {
|
||||
var _class2 = function () {
|
||||
babelHelpers.classCallCheck(this, _class2);
|
||||
@ -39,16 +39,16 @@ var TestConstructorOnly = (function (_ref2) {
|
||||
})());
|
||||
|
||||
var TestMethodOnly = (function (_ref3) {
|
||||
var _TestMethodOnly = function TestMethodOnly() {
|
||||
babelHelpers.classCallCheck(this, _TestMethodOnly);
|
||||
function TestMethodOnly() {
|
||||
babelHelpers.classCallCheck(this, TestMethodOnly);
|
||||
|
||||
if (_ref3 != null) {
|
||||
_ref3.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_TestMethodOnly, _ref3);
|
||||
return _TestMethodOnly;
|
||||
babelHelpers.inherits(TestMethodOnly, _ref3);
|
||||
return TestMethodOnly;
|
||||
})((function () {
|
||||
var _class3 = function () {
|
||||
babelHelpers.classCallCheck(this, _class3);
|
||||
@ -63,16 +63,16 @@ var TestMethodOnly = (function (_ref3) {
|
||||
})());
|
||||
|
||||
var TestConstructorAndMethod = (function (_ref4) {
|
||||
var _TestConstructorAndMethod = function TestConstructorAndMethod() {
|
||||
babelHelpers.classCallCheck(this, _TestConstructorAndMethod);
|
||||
function TestConstructorAndMethod() {
|
||||
babelHelpers.classCallCheck(this, TestConstructorAndMethod);
|
||||
|
||||
if (_ref4 != null) {
|
||||
_ref4.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_TestConstructorAndMethod, _ref4);
|
||||
return _TestConstructorAndMethod;
|
||||
babelHelpers.inherits(TestConstructorAndMethod, _ref4);
|
||||
return TestConstructorAndMethod;
|
||||
})((function () {
|
||||
var _class4 = function () {
|
||||
babelHelpers.classCallCheck(this, _class4);
|
||||
@ -87,16 +87,16 @@ var TestConstructorAndMethod = (function (_ref4) {
|
||||
})());
|
||||
|
||||
var TestMultipleMethods = (function (_ref5) {
|
||||
var _TestMultipleMethods = function TestMultipleMethods() {
|
||||
babelHelpers.classCallCheck(this, _TestMultipleMethods);
|
||||
function TestMultipleMethods() {
|
||||
babelHelpers.classCallCheck(this, TestMultipleMethods);
|
||||
|
||||
if (_ref5 != null) {
|
||||
_ref5.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_TestMultipleMethods, _ref5);
|
||||
return _TestMultipleMethods;
|
||||
babelHelpers.inherits(TestMultipleMethods, _ref5);
|
||||
return TestMultipleMethods;
|
||||
})((function () {
|
||||
var _class5 = function () {
|
||||
babelHelpers.classCallCheck(this, _class5);
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
var BaseController = (function (_Chaplin$Controller) {
|
||||
var _BaseController = function BaseController() {
|
||||
babelHelpers.classCallCheck(this, _BaseController);
|
||||
function BaseController() {
|
||||
babelHelpers.classCallCheck(this, BaseController);
|
||||
|
||||
if (_Chaplin$Controller != null) {
|
||||
_Chaplin$Controller.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_BaseController, _Chaplin$Controller);
|
||||
return _BaseController;
|
||||
babelHelpers.inherits(BaseController, _Chaplin$Controller);
|
||||
return BaseController;
|
||||
})(Chaplin.Controller);
|
||||
|
||||
var BaseController2 = (function (_Chaplin$Controller$Another) {
|
||||
var _BaseController2 = function BaseController2() {
|
||||
babelHelpers.classCallCheck(this, _BaseController2);
|
||||
function BaseController2() {
|
||||
babelHelpers.classCallCheck(this, BaseController2);
|
||||
|
||||
if (_Chaplin$Controller$Another != null) {
|
||||
_Chaplin$Controller$Another.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_BaseController2, _Chaplin$Controller$Another);
|
||||
return _BaseController2;
|
||||
babelHelpers.inherits(BaseController2, _Chaplin$Controller$Another);
|
||||
return BaseController2;
|
||||
})(Chaplin.Controller.Another);
|
||||
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function (_Foo) {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
if (_Foo != null) {
|
||||
_Foo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
babelHelpers.inherits(_Test, _Foo);
|
||||
return _Test;
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
return Test;
|
||||
})(Foo);
|
||||
@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
babelHelpers.classCallCheck(this, _Test);
|
||||
function Test() {
|
||||
babelHelpers.classCallCheck(this, Test);
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(_Test.prototype), "hasOwnProperty", this).call(this, "test");
|
||||
};
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
|
||||
}
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
@ -24,11 +24,11 @@ define(["exports", "module"], function (exports, module) {
|
||||
function foo() {}
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
module.exports = Foo;
|
||||
|
||||
@ -16,11 +16,11 @@ define(["exports"], function (exports) {
|
||||
function foo7() {}
|
||||
|
||||
var foo8 = exports.foo8 = (function () {
|
||||
var _foo8 = function foo8() {
|
||||
_classCallCheck(this, _foo8);
|
||||
};
|
||||
function foo8() {
|
||||
_classCallCheck(this, foo8);
|
||||
}
|
||||
|
||||
return _foo8;
|
||||
return foo8;
|
||||
})();
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
@ -23,11 +23,11 @@ module.exports = _default;
|
||||
function foo() {}
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
module.exports = Foo;
|
||||
@ -15,11 +15,11 @@ var foo6 = exports.foo6 = 3;
|
||||
function foo7() {}
|
||||
|
||||
var foo8 = exports.foo8 = (function () {
|
||||
var _foo8 = function foo8() {
|
||||
_classCallCheck(this, _foo8);
|
||||
};
|
||||
function foo8() {
|
||||
_classCallCheck(this, foo8);
|
||||
}
|
||||
|
||||
return _foo8;
|
||||
return foo8;
|
||||
})();
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
@ -13,9 +13,9 @@ var _default = (function () {
|
||||
function foo() {}
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
@ -14,9 +14,9 @@ var foo6 = 3;
|
||||
function foo7() {}
|
||||
|
||||
var foo8 = (function () {
|
||||
var _foo8 = function foo8() {
|
||||
_classCallCheck(this, _foo8);
|
||||
};
|
||||
function foo8() {
|
||||
_classCallCheck(this, foo8);
|
||||
}
|
||||
|
||||
return _foo8;
|
||||
return foo8;
|
||||
})();
|
||||
@ -33,11 +33,11 @@ System.register([], function (_export) {
|
||||
_export("default", _default);
|
||||
|
||||
Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
_export("default", Foo);
|
||||
|
||||
@ -19,11 +19,11 @@ System.register([], function (_export) {
|
||||
foo5 = _export("foo5", undefined);
|
||||
foo6 = _export("foo6", 3);
|
||||
foo8 = _export("foo8", (function () {
|
||||
var _foo8 = function foo8() {
|
||||
_classCallCheck(this, _foo8);
|
||||
};
|
||||
function foo8() {
|
||||
_classCallCheck(this, foo8);
|
||||
}
|
||||
|
||||
return _foo8;
|
||||
return foo8;
|
||||
})());
|
||||
|
||||
_export("foo3", foo3 = 5);
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
function foo() {}
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
module.exports = Foo;
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
function foo7() {}
|
||||
|
||||
var foo8 = exports.foo8 = (function () {
|
||||
var _foo8 = function foo8() {
|
||||
_classCallCheck(this, _foo8);
|
||||
};
|
||||
function foo8() {
|
||||
_classCallCheck(this, foo8);
|
||||
}
|
||||
|
||||
return _foo8;
|
||||
return foo8;
|
||||
})();
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
||||
@ -7,14 +7,15 @@ var B = new WeakMap(),
|
||||
C = new WeakMap();
|
||||
|
||||
var D = (function () {
|
||||
var _D = function D() {
|
||||
_classCallCheck(this, _D);
|
||||
};
|
||||
|
||||
var F = new WeakMap(),
|
||||
G = new WeakMap();
|
||||
var E = new WeakMap();
|
||||
return _D;
|
||||
|
||||
function D() {
|
||||
_classCallCheck(this, D);
|
||||
}
|
||||
|
||||
return D;
|
||||
})();
|
||||
|
||||
var H = (function () {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
var _Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
};
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(_Foo, babelHelpers.defineProperty({
|
||||
babelHelpers.createClass(Foo, babelHelpers.defineProperty({
|
||||
bar: {
|
||||
get: function () {
|
||||
return babelHelpers.defineProperty(this, "bar", complex()).bar;
|
||||
@ -16,7 +16,7 @@ var Foo = (function () {
|
||||
return babelHelpers.defineProperty(this, bar, complex())[bar];
|
||||
}
|
||||
}));
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var foo = Object.defineProperties({}, babelHelpers.defineProperty({
|
||||
|
||||
@ -5,11 +5,11 @@ var _createClass = (function () { function defineProperties(target, props) { for
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
var Test = (function () {
|
||||
var _Test = function Test() {
|
||||
_classCallCheck(this, _Test);
|
||||
};
|
||||
function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
}
|
||||
|
||||
_createClass(_Test, {
|
||||
_createClass(Test, {
|
||||
bar: {
|
||||
get: function () {
|
||||
throw new Error("wow");
|
||||
@ -17,7 +17,7 @@ var Test = (function () {
|
||||
}
|
||||
});
|
||||
|
||||
return _Test;
|
||||
return Test;
|
||||
})();
|
||||
|
||||
var test = new Test();
|
||||
|
||||
@ -7,15 +7,15 @@ var _inherits = function (subClass, superClass) { if (typeof superClass !== "fun
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
var _Foo = function Foo() {
|
||||
_classCallCheck(this, _Foo);
|
||||
function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
|
||||
if (_Bar != null) {
|
||||
_Bar.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_inherits(_Foo, _Bar);
|
||||
_inherits(Foo, _Bar);
|
||||
|
||||
return _Foo;
|
||||
return Foo;
|
||||
})(Bar);
|
||||
Loading…
x
Reference in New Issue
Block a user