Skip to content

Commit 9a81601

Browse files
zherczegdbatyai
authored andcommitted
Nested destructuring binding patterns should inherit the PARSER_PATTERN_ARGUMENTS flag. (#3508)
Fixes #3398. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
1 parent be83ff6 commit 9a81601

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

jerry-core/parser/js/js-parser-expr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,8 @@ parser_pattern_process_nested_pattern (parser_context_t *context_p, /**< context
25312531
| (flags & (PARSER_PATTERN_BINDING
25322532
| PARSER_PATTERN_LEXICAL
25332533
| PARSER_PATTERN_LOCAL
2534-
| PARSER_PATTERN_REST_ELEMENT)));
2534+
| PARSER_PATTERN_REST_ELEMENT
2535+
| PARSER_PATTERN_ARGUMENTS)));
25352536

25362537
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
25372538
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
function f($, [
16+
[b, [c] = [], {} = {
17+
$: eval()
18+
}]
19+
] = [[]], c) {}
20+
f()

0 commit comments

Comments
 (0)