Add support for computed class property names (#120) (#121)

This commit is contained in:
Moti Zilberman
2016-09-22 04:24:59 +03:00
committed by Henry Zhu
parent b68918e377
commit 4e1fbd48d5
5 changed files with 314 additions and 2 deletions

View File

@@ -672,13 +672,13 @@ pp.parseClassBody = function (node) {
this.parsePropertyName(method);
}
if (!isGenerator && method.key.type === "Identifier" && !method.computed) {
if (!isGenerator) {
if (this.isClassProperty()) {
classBody.body.push(this.parseClassProperty(method));
continue;
}
if (this.hasPlugin("classConstructorCall") && method.key.name === "call" && this.match(tt.name) && this.state.value === "constructor") {
if (method.key.type === "Identifier" && !method.computed && this.hasPlugin("classConstructorCall") && method.key.name === "call" && this.match(tt.name) && this.state.value === "constructor") {
isConstructorCall = true;
this.parsePropertyName(method);
}