add configurable and writable property to defined properties
This commit is contained in:
@@ -145,11 +145,11 @@ Class.prototype.buildBody = function () {
|
||||
CLASS_NAME: className
|
||||
});
|
||||
|
||||
instanceProps = util.buildDefineProperties(this.instanceMutatorMap, protoId);
|
||||
instanceProps = util.buildDefineProperties(this.instanceMutatorMap, true);
|
||||
}
|
||||
|
||||
if (this.hasStaticMutators) {
|
||||
staticProps = util.buildDefineProperties(this.staticMutatorMap, className);
|
||||
staticProps = util.buildDefineProperties(this.staticMutatorMap, true);
|
||||
}
|
||||
|
||||
if (instanceProps || staticProps) {
|
||||
|
||||
@@ -93,7 +93,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
|
||||
map[kind] = method;
|
||||
};
|
||||
|
||||
exports.buildDefineProperties = function (mutatorMap) {
|
||||
exports.buildDefineProperties = function (mutatorMap, writable) {
|
||||
var objExpr = t.objectExpression([]);
|
||||
|
||||
_.each(mutatorMap, function (map) {
|
||||
@@ -101,7 +101,9 @@ exports.buildDefineProperties = function (mutatorMap) {
|
||||
|
||||
var propNode = t.property("init", map._key, mapNode, map._computed);
|
||||
|
||||
if (writable) map.writable = t.literal(true);
|
||||
map.enumerable = t.literal(true);
|
||||
map.configurable = t.literal(true);
|
||||
|
||||
_.each(map, function (node, key) {
|
||||
if (key[0] === "_") return;
|
||||
|
||||
Reference in New Issue
Block a user