diff --git a/lib/6to5/transformation/transformers/es6-classes.js b/lib/6to5/transformation/transformers/es6-classes.js index 063a91aaa4..18c2657ca3 100644 --- a/lib/6to5/transformation/transformers/es6-classes.js +++ b/lib/6to5/transformation/transformers/es6-classes.js @@ -141,11 +141,11 @@ Class.prototype.buildBody = function () { var staticProps; if (this.hasInstanceMutators) { - instanceProps = util.buildDefineProperties(this.instanceMutatorMap, true); + instanceProps = util.buildDefineProperties(this.instanceMutatorMap); } if (this.hasStaticMutators) { - staticProps = util.buildDefineProperties(this.staticMutatorMap, true); + staticProps = util.buildDefineProperties(this.staticMutatorMap); } if (instanceProps || staticProps) { diff --git a/lib/6to5/util.js b/lib/6to5/util.js index 659ec25ed5..d161eec184 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -93,7 +93,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) { map[kind] = method; }; -exports.buildDefineProperties = function (mutatorMap, writable) { +exports.buildDefineProperties = function (mutatorMap) { var objExpr = t.objectExpression([]); _.each(mutatorMap, function (map) { @@ -101,7 +101,10 @@ exports.buildDefineProperties = function (mutatorMap, writable) { var propNode = t.property("init", map._key, mapNode, map._computed); - if (writable) map.writable = t.literal(true); + if (!map.get && !map.set) { + map.writable = t.literal(true); + } + map.enumerable = t.literal(true); map.configurable = t.literal(true); 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 e9b1e3b709..69617191a5 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 @@ -16,7 +16,6 @@ var Test = (function () { set: function (val) { this._test = val; }, - writable: true, enumerable: true, configurable: true } diff --git a/test/fixtures/transformation/es6-classes/instance-getter/expected.js b/test/fixtures/transformation/es6-classes/instance-getter/expected.js index af576011f1..997a39bcd9 100644 --- a/test/fixtures/transformation/es6-classes/instance-getter/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-getter/expected.js @@ -13,7 +13,6 @@ var Test = (function () { get: function () { return 5 + 5; }, - writable: true, enumerable: true, configurable: true } diff --git a/test/fixtures/transformation/es6-classes/instance-setter/expected.js b/test/fixtures/transformation/es6-classes/instance-setter/expected.js index d713ba3a2c..96f0db0ad7 100644 --- a/test/fixtures/transformation/es6-classes/instance-setter/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-setter/expected.js @@ -13,7 +13,6 @@ var Test = (function () { set: function (val) { this._test = val; }, - writable: true, enumerable: true, configurable: true } diff --git a/test/fixtures/transformation/es6-classes/static/expected.js b/test/fixtures/transformation/es6-classes/static/expected.js index 7f0b2e0806..6f1deec853 100644 --- a/test/fixtures/transformation/es6-classes/static/expected.js +++ b/test/fixtures/transformation/es6-classes/static/expected.js @@ -14,7 +14,6 @@ var A = (function () { b: { get: function () {}, set: function (b) {}, - writable: true, enumerable: true, configurable: true } diff --git a/test/fixtures/transformation/playground/object-getter-memoization/expected.js b/test/fixtures/transformation/playground/object-getter-memoization/expected.js index 8b6a42a193..a581ab4d3a 100644 --- a/test/fixtures/transformation/playground/object-getter-memoization/expected.js +++ b/test/fixtures/transformation/playground/object-getter-memoization/expected.js @@ -22,7 +22,6 @@ var Foo = (function () { get: function () { return _defineProperty(this, "bar", complex()).bar; }, - writable: true, enumerable: true, configurable: true } @@ -30,7 +29,6 @@ var Foo = (function () { get: function () { return _defineProperty(this, bar, complex())[bar]; }, - writable: true, enumerable: true, configurable: true })); diff --git a/test/fixtures/transformation/source-maps/class/expected.js b/test/fixtures/transformation/source-maps/class/expected.js index ced471078f..71d586257e 100644 --- a/test/fixtures/transformation/source-maps/class/expected.js +++ b/test/fixtures/transformation/source-maps/class/expected.js @@ -13,7 +13,6 @@ var Test = (function () { get: function () { throw new Error("wow"); }, - writable: true, enumerable: true, configurable: true }