420857 - Part 3: Report the position of opening brace for missing brace error in object literal.

This commit is contained in:
Gaming4JC 2019-07-14 10:24:25 -04:00 committed by Roy Tam
commit f1f51320fb
2 changed files with 10 additions and 1 deletions

View file

@ -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();
}
}

View file

@ -74,3 +74,10 @@ try {
if (true) {
}
`, [3, 10]);
// Object literal.
test(`
var x = {
foo: {
};
`, [2, 8]);