From a3eb8900a98d5417eabcc54447f067c5f7b65985 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 18 Dec 2014 01:09:24 +1100 Subject: [PATCH] add if super check to constructor default --- .../super-class-id-member-expression/expected.js | 8 ++++++-- .../super-class-id-non-identifiers/expected.js | 4 +++- .../transformation/es6-classes/super-class/expected.js | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) 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 27635243a2..8349f0dbe3 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 @@ -13,13 +13,17 @@ var _extends = function (child, parent) { }; var BaseController = function BaseController() { - Chaplin.Controller.apply(this, arguments); + if (Chaplin.Controller) { + Chaplin.Controller.apply(this, arguments); + } }; _extends(BaseController, Chaplin.Controller); var BaseController2 = function BaseController2() { - Chaplin.Controller.Another.apply(this, arguments); + if (Chaplin.Controller.Another) { + Chaplin.Controller.Another.apply(this, arguments); + } }; _extends(BaseController2, Chaplin.Controller.Another); diff --git a/test/fixtures/transformation/es6-classes/super-class-id-non-identifiers/expected.js b/test/fixtures/transformation/es6-classes/super-class-id-non-identifiers/expected.js index 83a25652fb..e3085e2526 100644 --- a/test/fixtures/transformation/es6-classes/super-class-id-non-identifiers/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class-id-non-identifiers/expected.js @@ -15,7 +15,9 @@ var _extends = function (child, parent) { var _QSuper = function () {}; var Q = function Q() { - _QSuper.apply(this, arguments); + if (_QSuper) { + _QSuper.apply(this, arguments); + } }; _extends(Q, _QSuper); diff --git a/test/fixtures/transformation/es6-classes/super-class/expected.js b/test/fixtures/transformation/es6-classes/super-class/expected.js index a4e3858bd8..d7d6bcbb27 100644 --- a/test/fixtures/transformation/es6-classes/super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class/expected.js @@ -13,7 +13,9 @@ var _extends = function (child, parent) { }; var Test = function Test() { - Foo.apply(this, arguments); + if (Foo) { + Foo.apply(this, arguments); + } }; _extends(Test, Foo);