Skip to content

Commit 6c21c08

Browse files
rerobikarobertsipka
authored andcommitted
Fix ecma_op_function_list_lazy_property_names in case of arrow function (#2529)
Fixes #2528. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 3d3a800 commit 6c21c08

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

jerry-core/ecma/operations/ecma-function-object.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,19 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
11191119
0);
11201120

11211121
const ecma_compiled_code_t *bytecode_data_p;
1122+
1123+
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
1124+
if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARROW_FUNCTION)
1125+
{
1126+
bytecode_data_p = ecma_op_arrow_function_get_compiled_code ((ecma_arrow_function_t *) object_p);
1127+
}
1128+
else
1129+
{
1130+
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
1131+
}
1132+
#else /* CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
11221133
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
1134+
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
11231135

11241136
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
11251137
{
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
for (/a/ in a => { }, a => { }, a => { }) throw 1

0 commit comments

Comments
 (0)