diff --git a/lib/6to5/transformation/templates/inherits.js b/lib/6to5/transformation/templates/inherits.js index 8822bbea7e..5596366744 100644 --- a/lib/6to5/transformation/templates/inherits.js +++ b/lib/6to5/transformation/templates/inherits.js @@ -1,14 +1,14 @@ -(function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +(function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }) 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 ba500fb940..883043cefa 100644 --- a/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js @@ -28,19 +28,19 @@ var _get = function get(object, property, receiver) { } }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { 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 fe231fa303..52e3b4be2d 100644 --- a/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes/accessing-super-properties/expected.js @@ -22,19 +22,19 @@ var _get = function get(object, property, receiver) { } }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { 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 b388800218..d78dea51a6 100644 --- a/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js @@ -27,19 +27,19 @@ var _get = function get(object, property, receiver) { } }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/es6-classes/constructor/expected.js b/test/fixtures/transformation/es6-classes/constructor/expected.js index ce1a7be09c..ae8840986d 100644 --- a/test/fixtures/transformation/es6-classes/constructor/expected.js +++ b/test/fixtures/transformation/es6-classes/constructor/expected.js @@ -1,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = function Test() { 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 6e5d8fd829..08405597c2 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,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var BaseController = (function (_Chaplin$Controller) { diff --git a/test/fixtures/transformation/es6-classes/super-class/expected.js b/test/fixtures/transformation/es6-classes/super-class/expected.js index bd9234406b..c425a6db4b 100644 --- a/test/fixtures/transformation/es6-classes/super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/super-class/expected.js @@ -1,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/optional-classes-fast-super/accessing-super-class/expected.js b/test/fixtures/transformation/optional-classes-fast-super/accessing-super-class/expected.js index 821e2b4f02..a66637e0eb 100644 --- a/test/fixtures/transformation/optional-classes-fast-super/accessing-super-class/expected.js +++ b/test/fixtures/transformation/optional-classes-fast-super/accessing-super-class/expected.js @@ -6,19 +6,19 @@ var _prototypeProperties = function (child, staticProps, instanceProps) { if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/optional-classes-fast-super/accessing-super-properties/expected.js b/test/fixtures/transformation/optional-classes-fast-super/accessing-super-properties/expected.js index bf1a718a95..b6032c2891 100644 --- a/test/fixtures/transformation/optional-classes-fast-super/accessing-super-properties/expected.js +++ b/test/fixtures/transformation/optional-classes-fast-super/accessing-super-properties/expected.js @@ -1,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/optional-classes-fast-super/calling-super-properties/expected.js b/test/fixtures/transformation/optional-classes-fast-super/calling-super-properties/expected.js index 8eebc5204e..f1ec1f6da5 100644 --- a/test/fixtures/transformation/optional-classes-fast-super/calling-super-properties/expected.js +++ b/test/fixtures/transformation/optional-classes-fast-super/calling-super-properties/expected.js @@ -5,19 +5,19 @@ var _prototypeProperties = function (child, staticProps, instanceProps) { if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/optional-classes-fast-super/super-class-id-member-expression/expected.js b/test/fixtures/transformation/optional-classes-fast-super/super-class-id-member-expression/expected.js index 058b2d7217..813528f129 100644 --- a/test/fixtures/transformation/optional-classes-fast-super/super-class-id-member-expression/expected.js +++ b/test/fixtures/transformation/optional-classes-fast-super/super-class-id-member-expression/expected.js @@ -1,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var BaseController = (function (_Chaplin$Controller) { diff --git a/test/fixtures/transformation/optional-classes-fast-super/super-class/expected.js b/test/fixtures/transformation/optional-classes-fast-super/super-class/expected.js index 4628b9a5ef..1725f9b1bf 100644 --- a/test/fixtures/transformation/optional-classes-fast-super/super-class/expected.js +++ b/test/fixtures/transformation/optional-classes-fast-super/super-class/expected.js @@ -1,18 +1,18 @@ "use strict"; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) child.__proto__ = parent; + if (superClass) subClass.__proto__ = superClass; }; var Test = (function (Foo) { diff --git a/test/fixtures/transformation/optional-proto-to-assign/class/expected.js b/test/fixtures/transformation/optional-proto-to-assign/class/expected.js index 59892c84f0..a4d0ea8aef 100644 --- a/test/fixtures/transformation/optional-proto-to-assign/class/expected.js +++ b/test/fixtures/transformation/optional-proto-to-assign/class/expected.js @@ -10,19 +10,19 @@ var _defaults = function (obj, defaults) { return obj; }; -var _inherits = function (child, parent) { - if (typeof parent !== "function" && parent !== null) { - throw new TypeError("Super expression must either be null or a function, not " + typeof parent); +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); } - child.prototype = Object.create(parent && parent.prototype, { + subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { - value: child, + value: subClass, enumerable: false, writable: true, configurable: true } }); - if (parent) _defaults(child, parent); + if (superClass) _defaults(subClass, superClass); }; var Foo = (function (Bar) {