fix writable being set on accessors
This commit is contained in:
parent
24616fa08a
commit
82aa2686f9
@ -141,11 +141,11 @@ Class.prototype.buildBody = function () {
|
|||||||
var staticProps;
|
var staticProps;
|
||||||
|
|
||||||
if (this.hasInstanceMutators) {
|
if (this.hasInstanceMutators) {
|
||||||
instanceProps = util.buildDefineProperties(this.instanceMutatorMap, true);
|
instanceProps = util.buildDefineProperties(this.instanceMutatorMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasStaticMutators) {
|
if (this.hasStaticMutators) {
|
||||||
staticProps = util.buildDefineProperties(this.staticMutatorMap, true);
|
staticProps = util.buildDefineProperties(this.staticMutatorMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instanceProps || staticProps) {
|
if (instanceProps || staticProps) {
|
||||||
|
|||||||
@ -93,7 +93,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
|
|||||||
map[kind] = method;
|
map[kind] = method;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.buildDefineProperties = function (mutatorMap, writable) {
|
exports.buildDefineProperties = function (mutatorMap) {
|
||||||
var objExpr = t.objectExpression([]);
|
var objExpr = t.objectExpression([]);
|
||||||
|
|
||||||
_.each(mutatorMap, function (map) {
|
_.each(mutatorMap, function (map) {
|
||||||
@ -101,7 +101,10 @@ exports.buildDefineProperties = function (mutatorMap, writable) {
|
|||||||
|
|
||||||
var propNode = t.property("init", map._key, mapNode, map._computed);
|
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.enumerable = t.literal(true);
|
||||||
map.configurable = t.literal(true);
|
map.configurable = t.literal(true);
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,6 @@ var Test = (function () {
|
|||||||
set: function (val) {
|
set: function (val) {
|
||||||
this._test = val;
|
this._test = val;
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ var Test = (function () {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return 5 + 5;
|
return 5 + 5;
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ var Test = (function () {
|
|||||||
set: function (val) {
|
set: function (val) {
|
||||||
this._test = val;
|
this._test = val;
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,6 @@ var A = (function () {
|
|||||||
b: {
|
b: {
|
||||||
get: function () {},
|
get: function () {},
|
||||||
set: function (b) {},
|
set: function (b) {},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,6 @@ var Foo = (function () {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return _defineProperty(this, "bar", complex()).bar;
|
return _defineProperty(this, "bar", complex()).bar;
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
@ -30,7 +29,6 @@ var Foo = (function () {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return _defineProperty(this, bar, complex())[bar];
|
return _defineProperty(this, bar, complex())[bar];
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -13,7 +13,6 @@ var Test = (function () {
|
|||||||
get: function () {
|
get: function () {
|
||||||
throw new Error("wow");
|
throw new Error("wow");
|
||||||
},
|
},
|
||||||
writable: true,
|
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user