diff --git a/acorn.js b/acorn.js index 53cd0d6113..fc7aeafd3d 100644 --- a/acorn.js +++ b/acorn.js @@ -2082,7 +2082,7 @@ if (options.allowTrailingCommas && eat(_braceR)) break; } else first = false; - var prop = startNode(), kind, isGenerator; + var prop = startNode(), isGenerator; if (options.ecmaVersion >= 6) { prop.method = false; prop.shorthand = false; @@ -2091,19 +2091,19 @@ parsePropertyName(prop); if (eat(_colon)) { prop.value = parseExpression(true); - kind = prop.kind = "init"; + prop.kind = "init"; } else if (options.ecmaVersion >= 6 && tokType === _parenL) { - kind = prop.kind = "init"; + prop.kind = "init"; prop.method = true; prop.value = parseMethod(isGenerator); } else if (options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set")) { if (isGenerator) unexpected(); - kind = prop.kind = prop.key.name; + prop.kind = prop.key.name; parsePropertyName(prop); prop.value = parseMethod(false); } else if (options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { - kind = prop.kind = "init"; + prop.kind = "init"; prop.value = prop.key; prop.shorthand = true; } else unexpected(); diff --git a/acorn_loose.js b/acorn_loose.js index de29599abf..208c188afc 100644 --- a/acorn_loose.js +++ b/acorn_loose.js @@ -693,15 +693,14 @@ while (!closes(tt.braceR, propIndent, line)) { var name = parsePropertyName(); if (!name) { if (isDummy(parseExpression(true))) next(); eat(tt.comma); continue; } - var prop = startNode(), isGetSet = false, kind; + var prop = startNode(); prop.key = name; if (eat(tt.colon)) { prop.value = parseExpression(true); - kind = prop.kind = "init"; + prop.kind = "init"; } else if (options.ecmaVersion >= 5 && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set")) { - isGetSet = true; - kind = prop.kind = prop.key.name; + prop.kind = prop.key.name; prop.key = parsePropertyName() || dummyIdent(); prop.value = parseFunction(startNode(), false); } else {