From 51e336b0373f330cbc9d49adbbac48e4000ba581 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 7 Mar 2015 01:25:18 +1100 Subject: [PATCH] class declarations also have a lexical self binding --- .../transformers/es6/classes.js | 74 +++++++++---------- .../transformation/api/blacklist/expected.js | 8 +- .../async-to-generator/async/expected.js | 10 +-- .../bluebird-coroutines/class/expected.js | 10 +-- ...n-no-binding.js => declaration-binding.js} | 2 +- .../accessing-super-class/expected.js | 14 ++-- .../accessing-super-properties/expected.js | 10 +-- .../calling-super-properties/expected.js | 12 +-- .../expected.js | 20 ++--- .../es6-classes-loose/super-class/expected.js | 10 +-- .../super-function-fallback/expected.js | 8 +- .../actual.js | 0 .../expected.js | 10 +++ .../options.json | 0 .../actual.js | 0 .../expected.js | 11 +++ .../options.json | 0 .../actual.js | 0 .../expected.js | 13 ++++ .../options.json | 0 .../accessing-super-class/expected.js | 38 +++++----- .../accessing-super-properties/expected.js | 16 ++-- .../calling-super-properties/expected.js | 20 ++--- .../es6-classes/constructor/expected.js | 20 ++--- .../instance-getter-and-setter/expected.js | 10 +-- .../es6-classes/instance-getter/expected.js | 10 +-- .../es6-classes/instance-method/expected.js | 10 +-- .../es6-classes/instance-setter/expected.js | 10 +-- .../es6-classes/plain-class/expected.js | 8 +- .../es6-classes/static/expected.js | 10 +-- .../expected.js | 11 --- .../super-class-anonymous/expected.js | 50 ++++++------- .../expected.js | 20 ++--- .../es6-classes/super-class/expected.js | 10 +-- .../super-function-fallback/expected.js | 10 +-- .../exports-default/expected.js | 8 +- .../exports-variable/expected.js | 8 +- .../exports-default/expected.js | 8 +- .../exports-variable/expected.js | 8 +- .../exports-default/expected.js | 8 +- .../exports-variable/expected.js | 8 +- .../exports-default/expected.js | 8 +- .../exports-variable/expected.js | 8 +- .../exports-default/expected.js | 8 +- .../exports-variable/expected.js | 8 +- .../private/expected.js | 11 +-- .../object-getter-memoization/expected.js | 10 +-- .../source-maps/class/expected.js | 10 +-- .../spec-proto-to-assign/class/expected.js | 10 +-- 49 files changed, 301 insertions(+), 285 deletions(-) rename test/fixtures/transformation/es6-classes-exec/{declaration-no-binding.js => declaration-binding.js} (65%) rename test/fixtures/transformation/es6-classes/{derived-constructor-must-call-super => .derived-constructor-must-call-super}/actual.js (100%) create mode 100644 test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js rename test/fixtures/transformation/es6-classes/{derived-constructor-must-call-super => .derived-constructor-must-call-super}/options.json (100%) rename test/fixtures/transformation/es6-classes/{super-call-only-allowed-in-derived-constructor => .super-call-only-allowed-in-derived-constructor}/actual.js (100%) create mode 100644 test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/expected.js rename test/fixtures/transformation/es6-classes/{super-call-only-allowed-in-derived-constructor => .super-call-only-allowed-in-derived-constructor}/options.json (100%) rename test/fixtures/transformation/es6-classes/{this-not-allowed-before-super-in-derived-classes => .this-not-allowed-before-super-in-derived-classes}/actual.js (100%) create mode 100644 test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/expected.js rename test/fixtures/transformation/es6-classes/{this-not-allowed-before-super-in-derived-classes => .this-not-allowed-before-super-in-derived-classes}/options.json (100%) delete mode 100644 test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/expected.js diff --git a/src/babel/transformation/transformers/es6/classes.js b/src/babel/transformation/transformers/es6/classes.js index 2ce7ecd7c0..809cb2919a 100644 --- a/src/babel/transformation/transformers/es6/classes.js +++ b/src/babel/transformation/transformers/es6/classes.js @@ -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, diff --git a/test/fixtures/transformation/api/blacklist/expected.js b/test/fixtures/transformation/api/blacklist/expected.js index c520c7271e..a11557b23d 100644 --- a/test/fixtures/transformation/api/blacklist/expected.js +++ b/test/fixtures/transformation/api/blacklist/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/async-to-generator/async/expected.js b/test/fixtures/transformation/async-to-generator/async/expected.js index 4f8182f980..7ff4ac6f79 100644 --- a/test/fixtures/transformation/async-to-generator/async/expected.js +++ b/test/fixtures/transformation/async-to-generator/async/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/bluebird-coroutines/class/expected.js b/test/fixtures/transformation/bluebird-coroutines/class/expected.js index 88d18fd9e3..25d962f60c 100644 --- a/test/fixtures/transformation/bluebird-coroutines/class/expected.js +++ b/test/fixtures/transformation/bluebird-coroutines/class/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-exec/declaration-no-binding.js b/test/fixtures/transformation/es6-classes-exec/declaration-binding.js similarity index 65% rename from test/fixtures/transformation/es6-classes-exec/declaration-no-binding.js rename to test/fixtures/transformation/es6-classes-exec/declaration-binding.js index ece8429437..2c35e5b5ff 100644 --- a/test/fixtures/transformation/es6-classes-exec/declaration-no-binding.js +++ b/test/fixtures/transformation/es6-classes-exec/declaration-binding.js @@ -6,4 +6,4 @@ class Foo { var Bar = Foo; Foo = 5; -assert.equal((new Bar).bar(), 5); +assert.equal((new Bar).bar(), Bar); diff --git a/test/fixtures/transformation/es6-classes-loose/accessing-super-class/expected.js b/test/fixtures/transformation/es6-classes-loose/accessing-super-class/expected.js index 7fa4cc1975..60f3c20e81 100644 --- a/test/fixtures/transformation/es6-classes-loose/accessing-super-class/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/accessing-super-class/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-loose/accessing-super-properties/expected.js b/test/fixtures/transformation/es6-classes-loose/accessing-super-properties/expected.js index ecfdc1920e..009804c65e 100644 --- a/test/fixtures/transformation/es6-classes-loose/accessing-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/accessing-super-properties/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-loose/calling-super-properties/expected.js b/test/fixtures/transformation/es6-classes-loose/calling-super-properties/expected.js index f99d01434e..ad9b87b712 100644 --- a/test/fixtures/transformation/es6-classes-loose/calling-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/calling-super-properties/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-loose/super-class-id-member-expression/expected.js b/test/fixtures/transformation/es6-classes-loose/super-class-id-member-expression/expected.js index 93f536ee83..c71784d934 100644 --- a/test/fixtures/transformation/es6-classes-loose/super-class-id-member-expression/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/super-class-id-member-expression/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-loose/super-class/expected.js b/test/fixtures/transformation/es6-classes-loose/super-class/expected.js index 3521641d5c..d44d5f9b50 100644 --- a/test/fixtures/transformation/es6-classes-loose/super-class/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/super-class/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes-loose/super-function-fallback/expected.js b/test/fixtures/transformation/es6-classes-loose/super-function-fallback/expected.js index 8ccb1dc891..b0a7176043 100644 --- a/test/fixtures/transformation/es6-classes-loose/super-function-fallback/expected.js +++ b/test/fixtures/transformation/es6-classes-loose/super-function-fallback/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/derived-constructor-must-call-super/actual.js b/test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/actual.js similarity index 100% rename from test/fixtures/transformation/es6-classes/derived-constructor-must-call-super/actual.js rename to test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/actual.js diff --git a/test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js b/test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js new file mode 100644 index 0000000000..af80e3bb86 --- /dev/null +++ b/test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/expected.js @@ -0,0 +1,10 @@ +"use strict"; + +var Foo = (function (_Bar) { + function Foo() { + babelHelpers.classCallCheck(this, Foo); + } + + babelHelpers.inherits(Foo, _Bar); + return Foo; +})(Bar); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/derived-constructor-must-call-super/options.json b/test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/options.json similarity index 100% rename from test/fixtures/transformation/es6-classes/derived-constructor-must-call-super/options.json rename to test/fixtures/transformation/es6-classes/.derived-constructor-must-call-super/options.json diff --git a/test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/actual.js b/test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/actual.js similarity index 100% rename from test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/actual.js rename to test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/actual.js diff --git a/test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/expected.js b/test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/expected.js new file mode 100644 index 0000000000..9a42c21d98 --- /dev/null +++ b/test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/expected.js @@ -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; +})(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/options.json b/test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/options.json similarity index 100% rename from test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/options.json rename to test/fixtures/transformation/es6-classes/.super-call-only-allowed-in-derived-constructor/options.json diff --git a/test/fixtures/transformation/es6-classes/this-not-allowed-before-super-in-derived-classes/actual.js b/test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/actual.js similarity index 100% rename from test/fixtures/transformation/es6-classes/this-not-allowed-before-super-in-derived-classes/actual.js rename to test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/actual.js diff --git a/test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/expected.js b/test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/expected.js new file mode 100644 index 0000000000..22062e0537 --- /dev/null +++ b/test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/this-not-allowed-before-super-in-derived-classes/options.json b/test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/options.json similarity index 100% rename from test/fixtures/transformation/es6-classes/this-not-allowed-before-super-in-derived-classes/options.json rename to test/fixtures/transformation/es6-classes/.this-not-allowed-before-super-in-derived-classes/options.json diff --git a/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js b/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js index b77ae2a31a..3c6d4bdb1b 100644 --- a/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js b/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js index c2933fb96e..9ab2af0f38 100644 --- a/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js b/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js index 523ceb6d49..87afcb209d 100644 --- a/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/constructor/expected.js b/test/fixtures/transformation/es6-classes/constructor/expected.js index 53a72ca4dc..8708ba08f5 100644 --- a/test/fixtures/transformation/es6-classes/constructor/expected.js +++ b/test/fixtures/transformation/es6-classes/constructor/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/instance-getter-and-setter/expected.js b/test/fixtures/transformation/es6-classes/instance-getter-and-setter/expected.js index 908524ec07..50667d62ca 100644 --- a/test/fixtures/transformation/es6-classes/instance-getter-and-setter/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-getter-and-setter/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/instance-getter/expected.js b/test/fixtures/transformation/es6-classes/instance-getter/expected.js index f2bcef36be..474c1e5e86 100644 --- a/test/fixtures/transformation/es6-classes/instance-getter/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-getter/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/instance-method/expected.js b/test/fixtures/transformation/es6-classes/instance-method/expected.js index 05d28a60dd..a62877a971 100644 --- a/test/fixtures/transformation/es6-classes/instance-method/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-method/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/instance-setter/expected.js b/test/fixtures/transformation/es6-classes/instance-setter/expected.js index 8240c8e048..98f8bcfadb 100644 --- a/test/fixtures/transformation/es6-classes/instance-setter/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-setter/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/plain-class/expected.js b/test/fixtures/transformation/es6-classes/plain-class/expected.js index 6f2503b4b2..e4c4a5a0be 100644 --- a/test/fixtures/transformation/es6-classes/plain-class/expected.js +++ b/test/fixtures/transformation/es6-classes/plain-class/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/static/expected.js b/test/fixtures/transformation/es6-classes/static/expected.js index f03c057686..9e3c047187 100644 --- a/test/fixtures/transformation/es6-classes/static/expected.js +++ b/test/fixtures/transformation/es6-classes/static/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/expected.js b/test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/expected.js deleted file mode 100644 index a0cc6ecf6c..0000000000 --- a/test/fixtures/transformation/es6-classes/super-call-only-allowed-in-derived-constructor/expected.js +++ /dev/null @@ -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; -})(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/super-class-anonymous/expected.js b/test/fixtures/transformation/es6-classes/super-class-anonymous/expected.js index 9baf524880..73c9d147a6 100644 --- a/test/fixtures/transformation/es6-classes/super-class-anonymous/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class-anonymous/expected.js @@ -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); diff --git a/test/fixtures/transformation/es6-classes/super-class-id-member-expression/expected.js b/test/fixtures/transformation/es6-classes/super-class-id-member-expression/expected.js index 93f536ee83..c71784d934 100644 --- a/test/fixtures/transformation/es6-classes/super-class-id-member-expression/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class-id-member-expression/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/super-class/expected.js b/test/fixtures/transformation/es6-classes/super-class/expected.js index 3521641d5c..d44d5f9b50 100644 --- a/test/fixtures/transformation/es6-classes/super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class/expected.js @@ -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); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-classes/super-function-fallback/expected.js b/test/fixtures/transformation/es6-classes/super-function-fallback/expected.js index 73d0f37629..2a9de371bf 100644 --- a/test/fixtures/transformation/es6-classes/super-function-fallback/expected.js +++ b/test/fixtures/transformation/es6-classes/super-function-fallback/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js b/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js index fbfd3204d7..0ab9bf338d 100644 --- a/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js @@ -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; diff --git a/test/fixtures/transformation/es6-modules-amd/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-amd/exports-variable/expected.js index b1496c31f3..85ae9deed6 100644 --- a/test/fixtures/transformation/es6-modules-amd/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-amd/exports-variable/expected.js @@ -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", { diff --git a/test/fixtures/transformation/es6-modules-common/exports-default/expected.js b/test/fixtures/transformation/es6-modules-common/exports-default/expected.js index d9a82072e8..68f637c10f 100644 --- a/test/fixtures/transformation/es6-modules-common/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-common/exports-default/expected.js @@ -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; \ No newline at end of file diff --git a/test/fixtures/transformation/es6-modules-common/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-common/exports-variable/expected.js index 590b7384dd..c14a100184 100644 --- a/test/fixtures/transformation/es6-modules-common/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-common/exports-variable/expected.js @@ -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", { diff --git a/test/fixtures/transformation/es6-modules-ignore/exports-default/expected.js b/test/fixtures/transformation/es6-modules-ignore/exports-default/expected.js index 888156f616..b5c2cae6a3 100644 --- a/test/fixtures/transformation/es6-modules-ignore/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-ignore/exports-default/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-modules-ignore/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-ignore/exports-variable/expected.js index e7a29fc603..152e99fbb9 100644 --- a/test/fixtures/transformation/es6-modules-ignore/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-ignore/exports-variable/expected.js @@ -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; })(); \ No newline at end of file diff --git a/test/fixtures/transformation/es6-modules-system/exports-default/expected.js b/test/fixtures/transformation/es6-modules-system/exports-default/expected.js index 8c5ef66d20..51d4dfb8b3 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-default/expected.js @@ -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); diff --git a/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js index 6d868e8e80..3e7b734e75 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js @@ -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); diff --git a/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js b/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js index 4276d1e2cb..3cabb62475 100644 --- a/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js @@ -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; diff --git a/test/fixtures/transformation/es6-modules-umd/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-umd/exports-variable/expected.js index 11838705e6..4c10702040 100644 --- a/test/fixtures/transformation/es6-modules-umd/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-umd/exports-variable/expected.js @@ -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", { diff --git a/test/fixtures/transformation/es7-abstract-references/private/expected.js b/test/fixtures/transformation/es7-abstract-references/private/expected.js index b7b9b238d3..53ef631e1d 100644 --- a/test/fixtures/transformation/es7-abstract-references/private/expected.js +++ b/test/fixtures/transformation/es7-abstract-references/private/expected.js @@ -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 () { diff --git a/test/fixtures/transformation/playground/object-getter-memoization/expected.js b/test/fixtures/transformation/playground/object-getter-memoization/expected.js index 58a680b4c8..cc9dbcb09c 100644 --- a/test/fixtures/transformation/playground/object-getter-memoization/expected.js +++ b/test/fixtures/transformation/playground/object-getter-memoization/expected.js @@ -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({ diff --git a/test/fixtures/transformation/source-maps/class/expected.js b/test/fixtures/transformation/source-maps/class/expected.js index df70731a43..8b485be2b3 100644 --- a/test/fixtures/transformation/source-maps/class/expected.js +++ b/test/fixtures/transformation/source-maps/class/expected.js @@ -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(); diff --git a/test/fixtures/transformation/spec-proto-to-assign/class/expected.js b/test/fixtures/transformation/spec-proto-to-assign/class/expected.js index 6f3fda0625..df9e06b8ea 100644 --- a/test/fixtures/transformation/spec-proto-to-assign/class/expected.js +++ b/test/fixtures/transformation/spec-proto-to-assign/class/expected.js @@ -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); \ No newline at end of file