Fix the value of the caller property of function instances (#4258)

We do not support the caller information for functions, and since a
'null' value represents that there has been no caller, the default value
should be changed to 'undefined' to signal that the information is not
available.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-10-01 12:10:11 +02:00
committed by GitHub
parent 69d9b2c326
commit b9e4897c71
4 changed files with 49 additions and 32 deletions
@@ -1600,8 +1600,10 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
return ecma_op_lazy_instantiate_prototype_object (object_p);
}
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)
|| ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS))
const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS);
if (is_arguments
|| ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))
{
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
@@ -1616,7 +1618,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
property_name_p,
ECMA_PROPERTY_FIXED,
&value_prop_p);
value_p->value = ECMA_VALUE_NULL;
value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED;
return value_prop_p;
}
#else /* !ENABLED (JERRY_ESNEXT) */