Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions jerry-core/ecma/operations/ecma-function-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,19 +2173,6 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);

#if JERRY_ESNEXT
bool append_prototype = CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags);
#else /* !JERRY_ESNEXT */
bool append_prototype = true;
#endif /* JERRY_ESNEXT */

if (append_prototype)
{
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
prop_counter_p->string_named_props++;
}

#if JERRY_ESNEXT
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;

Expand All @@ -2210,7 +2197,7 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
#endif /* JERRY_ESNEXT */

#if JERRY_ESNEXT
if (!append_prototype)
if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags))
{
return;
}
Expand All @@ -2222,14 +2209,18 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio

if (append_caller_and_arguments)
{
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));

/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));

/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));

prop_counter_p->string_named_props += 2;
}

/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
prop_counter_p->string_named_props++;
} /* ecma_op_function_list_lazy_property_names */

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/jerry/es.next/function-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Object.setPrototypeOf(print, prototype_obj);
assert(getProperties(print) == "dummy length caller arguments");

function f1() {}
assert(Reflect.ownKeys(f1).toString() === "prototype,length,name,caller,arguments")
assert(Reflect.ownKeys(f1).toString() === "length,name,arguments,caller,prototype")

async function f2() {}
assert(Reflect.ownKeys(f2).toString() === "length,name")