From 49680b1c60f21751f5e09756fb78fb573a2e59f0 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Mon, 22 Sep 2014 15:15:12 +0200 Subject: [PATCH] [loose parser] Take brace-line indentation into account for objlit closing heuristic --- acorn_loose.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acorn_loose.js b/acorn_loose.js index e490eb2761..c6b7f46bce 100644 --- a/acorn_loose.js +++ b/acorn_loose.js @@ -696,9 +696,10 @@ var node = startNode(); node.properties = []; pushCx(); + var indent = curIndent + 1, line = curLineStart; next(); - var propIndent = curIndent, line = curLineStart; - while (!closes(tt.braceR, propIndent + 1, line)) { + if (curIndent + 1 < indent) { indent = curIndent; line = curLineStart; } + while (!closes(tt.braceR, indent, line)) { var name = parsePropertyName(); if (!name) { if (isDummy(parseExpression(true))) next(); eat(tt.comma); continue; } var prop = startNode();