enumerable es6 class methods

This commit is contained in:
Sebastian McKenzie 2014-12-05 23:06:36 +11:00
parent 3d62af004d
commit c5214ffe70

View File

@ -162,17 +162,22 @@ Class.prototype.buildBody = function () {
Class.prototype.pushMethod = function (node) {
var methodName = node.key;
var mutatorMap = this.instanceMutatorMap;
if (node.static) mutatorMap = this.staticMutatorMap;
var kind = node.kind;
if (kind === "") {
kind = "value";
util.pushMutatorMap(mutatorMap, methodName, "writable", t.identifier("true"));
}
// method
util.pushMutatorMap(mutatorMap, methodName, kind, node);
var className = this.className;
if (!node.static) className = t.memberExpression(className, t.identifier("prototype"));
methodName = t.memberExpression(className, methodName, node.computed);
this.body.push(t.expressionStatement(t.assignmentExpression("=", methodName, node.value)));
} else {
// mutator
var mutatorMap = this.instanceMutatorMap;
if (node.static) mutatorMap = this.staticMutatorMap;
util.pushMutatorMap(mutatorMap, methodName, kind, node);
}
};
/**