Support nested destructuring patterns in catch header (#3488)
This patch fixes #3433. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
1725e014b8
commit
d0e8629342
@@ -1922,14 +1922,14 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
|
|||||||
#endif /* ENABLED (JERRY_ES2015) */
|
#endif /* ENABLED (JERRY_ES2015) */
|
||||||
|
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
|
|
||||||
|
#ifndef JERRY_NDEBUG
|
||||||
|
JERRY_ASSERT (block_found);
|
||||||
|
#endif /* !JERRY_NDEBUG */
|
||||||
#if ENABLED (JERRY_ES2015)
|
#if ENABLED (JERRY_ES2015)
|
||||||
}
|
}
|
||||||
#endif /* ENABLED (JERRY_ES2015) */
|
#endif /* ENABLED (JERRY_ES2015) */
|
||||||
|
|
||||||
#ifndef JERRY_NDEBUG
|
|
||||||
JERRY_ASSERT (block_found);
|
|
||||||
#endif /* !JERRY_NDEBUG */
|
|
||||||
|
|
||||||
if (context_p->token.type != LEXER_RIGHT_PAREN)
|
if (context_p->token.type != LEXER_RIGHT_PAREN)
|
||||||
{
|
{
|
||||||
parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);
|
parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);
|
||||||
|
|||||||
@@ -829,10 +829,8 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
|
|||||||
|
|
||||||
lexer_next_token (context_p);
|
lexer_next_token (context_p);
|
||||||
|
|
||||||
if (binding_type == SCANNER_BINDING_CATCH)
|
if (binding_type == SCANNER_BINDING_CATCH && context_p->stack_top_uint8 == SCAN_STACK_CATCH_STATEMENT)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_CATCH_STATEMENT);
|
|
||||||
|
|
||||||
scanner_pop_binding_list (scanner_context_p);
|
scanner_pop_binding_list (scanner_context_p);
|
||||||
|
|
||||||
if (context_p->token.type != LEXER_RIGHT_PAREN)
|
if (context_p->token.type != LEXER_RIGHT_PAREN)
|
||||||
|
|||||||
@@ -71,3 +71,19 @@ try {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert(e instanceof ReferenceError)
|
assert(e instanceof ReferenceError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
throw [{a : 5}];
|
||||||
|
} catch([{a}]) {
|
||||||
|
assert(a === 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
var catchReached = false;
|
||||||
|
try {
|
||||||
|
throw [{}];
|
||||||
|
assert(false);
|
||||||
|
} catch([{}]) {
|
||||||
|
catchReached = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(catchReached);
|
||||||
|
|||||||
Reference in New Issue
Block a user