enumerable es6 class methods
This commit is contained in:
parent
3d62af004d
commit
c5214ffe70
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user