diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-07-14 10:24:25 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:44 -0400 |
commit | 10227d77bfccda845a63e20b22bc4367ecc7b4e0 (patch) | |
tree | 8cc9ae0ab1315e3e4e438f31febc80ad208e1245 /js | |
parent | 3e1a8a74f2fc69f9df6f18ab19f5095722da7a60 (diff) | |
download | uxp-10227d77bfccda845a63e20b22bc4367ecc7b4e0.tar.gz |
420857 - Part 3: Report the position of opening brace for missing brace error in object literal.
Diffstat (limited to 'js')
-rw-r--r-- | js/src/frontend/Parser.cpp | 4 | ||||
-rw-r--r-- | js/src/jit-test/tests/parser/missing-closing-brace.js | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index ef352ec357..7dc3cdf8ff 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 2bb96b11b4..f97cefd81e 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]); |