summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/src/frontend/Parser.cpp4
-rw-r--r--js/src/jit-test/tests/parser/missing-closing-brace.js7
2 files changed, 10 insertions, 1 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index ef352ec35..7dc3cdf8f 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -9524,6 +9524,8 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LC));
+ uint32_t openedPos = pos().begin;
+
Node literal = handler.newObjectLiteral(pos().begin);
if (!literal)
return null();
@@ -9686,7 +9688,7 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
if (tt == TOK_RC)
break;
if (tt != TOK_COMMA) {
- error(JSMSG_CURLY_AFTER_LIST);
+ reportMissingClosing(JSMSG_CURLY_AFTER_LIST, JSMSG_CURLY_OPENED, openedPos);
return null();
}
}
diff --git a/js/src/jit-test/tests/parser/missing-closing-brace.js b/js/src/jit-test/tests/parser/missing-closing-brace.js
index 2bb96b11b..f97cefd81 100644
--- a/js/src/jit-test/tests/parser/missing-closing-brace.js
+++ b/js/src/jit-test/tests/parser/missing-closing-brace.js
@@ -74,3 +74,10 @@ try {
if (true) {
}
`, [3, 10]);
+
+// Object literal.
+test(`
+var x = {
+ foo: {
+};
+`, [2, 8]);