diff --git a/acorn.js b/acorn.js index 6ba8f97d81..95dd23bb7b 100644 --- a/acorn.js +++ b/acorn.js @@ -2524,8 +2524,7 @@ classBody.body = []; expect(_braceL); while (!eat(_braceR)) { - while (eat(_semi)); - if (tokType === _braceR) continue; + if (eat(_semi)) continue; var method = startNode(); var isGenerator = eat(_star); parsePropertyName(method); diff --git a/acorn_loose.js b/acorn_loose.js index 03d92b7352..a6542ee7d0 100644 --- a/acorn_loose.js +++ b/acorn_loose.js @@ -854,6 +854,7 @@ eat(tt.braceL); if (curIndent + 1 < indent) { indent = curIndent; line = curLineStart; } while (!closes(tt.braceR, indent, line)) { + if (isClass && semicolon()) continue; var prop = startNode(), isGenerator; if (options.ecmaVersion >= 6) { if (isClass) { @@ -904,7 +905,6 @@ if (isClass) { node.body.body.push(finishNode(prop, "MethodDefinition")); - semicolon(); } else { node.properties.push(finishNode(prop, "Property")); eat(tt.comma);