diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c index 7b4945386..61196bab2 100644 --- a/jerry-core/parser/js/js-parser-expr.c +++ b/jerry-core/parser/js/js-parser-expr.c @@ -2427,6 +2427,14 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */ parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN); } + if (context_p->last_cbc_opcode == CBC_PUSH_PROP_THIS_LITERAL) + { + context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE; + uint16_t lit_index = context_p->last_cbc.literal_index; + parser_emit_cbc (context_p, CBC_PUSH_THIS); + parser_emit_cbc_literal (context_p, CBC_PUSH_PROP_LITERAL, lit_index); + } + if (end_type == LEXER_RIGHT_SQUARE) { PARSER_PLUS_EQUAL_U16 (rhs_opcode, 1); diff --git a/tests/jerry/es2015/regression-test-issue-3348.js b/tests/jerry/es2015/regression-test-issue-3348.js new file mode 100644 index 000000000..1504193e7 --- /dev/null +++ b/tests/jerry/es2015/regression-test-issue-3348.js @@ -0,0 +1,19 @@ +// Copyright JS Foundation and other contributors, http://js.foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +try { + [$, this.$] = [ ]; +} catch (e) { + assert (e instanceof TypeError); +}