Fix this property reference on assignment patterns (#3365)
This patch fixes #3348. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Zoltan Herczeg
parent
12211d8aaa
commit
cbeecdb703
@@ -2427,6 +2427,14 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */
|
|||||||
parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN);
|
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)
|
if (end_type == LEXER_RIGHT_SQUARE)
|
||||||
{
|
{
|
||||||
PARSER_PLUS_EQUAL_U16 (rhs_opcode, 1);
|
PARSER_PLUS_EQUAL_U16 (rhs_opcode, 1);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user