Restore patch 9f7cb552648829796ab4d6836d08246e95f16b9d to original shape
And make loose parser handle stray class semicolons Issue #190
This commit is contained in:
parent
9f7cb55264
commit
a1d2561cfa
3
acorn.js
3
acorn.js
@ -2524,8 +2524,7 @@
|
|||||||
classBody.body = [];
|
classBody.body = [];
|
||||||
expect(_braceL);
|
expect(_braceL);
|
||||||
while (!eat(_braceR)) {
|
while (!eat(_braceR)) {
|
||||||
while (eat(_semi));
|
if (eat(_semi)) continue;
|
||||||
if (tokType === _braceR) continue;
|
|
||||||
var method = startNode();
|
var method = startNode();
|
||||||
var isGenerator = eat(_star);
|
var isGenerator = eat(_star);
|
||||||
parsePropertyName(method);
|
parsePropertyName(method);
|
||||||
|
|||||||
@ -854,6 +854,7 @@
|
|||||||
eat(tt.braceL);
|
eat(tt.braceL);
|
||||||
if (curIndent + 1 < indent) { indent = curIndent; line = curLineStart; }
|
if (curIndent + 1 < indent) { indent = curIndent; line = curLineStart; }
|
||||||
while (!closes(tt.braceR, indent, line)) {
|
while (!closes(tt.braceR, indent, line)) {
|
||||||
|
if (isClass && semicolon()) continue;
|
||||||
var prop = startNode(), isGenerator;
|
var prop = startNode(), isGenerator;
|
||||||
if (options.ecmaVersion >= 6) {
|
if (options.ecmaVersion >= 6) {
|
||||||
if (isClass) {
|
if (isClass) {
|
||||||
@ -904,7 +905,6 @@
|
|||||||
|
|
||||||
if (isClass) {
|
if (isClass) {
|
||||||
node.body.body.push(finishNode(prop, "MethodDefinition"));
|
node.body.body.push(finishNode(prop, "MethodDefinition"));
|
||||||
semicolon();
|
|
||||||
} else {
|
} else {
|
||||||
node.properties.push(finishNode(prop, "Property"));
|
node.properties.push(finishNode(prop, "Property"));
|
||||||
eat(tt.comma);
|
eat(tt.comma);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user