Fix Object.prototype.toLocaleString() and Array.prototype.toLocaleString() (#3953)

Since ES6 Object.prototype.toLocaleString() shouldn't call ToObject() and
Array.prototype.toLocaleString() shouldn't call ToObject() for each element.
References:
- https://www.ecma-international.org/ecma-262/11.0/index.html#sec-array.prototype.tolocalestring
- https://www.ecma-international.org/ecma-262/11.0/index.html#sec-object.prototype.tolocalestring

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2020-07-01 12:05:54 +02:00
committed by GitHub
parent 1064b19cfb
commit 0deeb39ebf
3 changed files with 18 additions and 9 deletions
@@ -235,8 +235,13 @@ ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /**< th
}
ecma_object_t *locale_func_obj_p = ecma_get_object_from_value (to_locale_value);
#if ENABLED (JERRY_ESNEXT)
ecma_value_t index_parameter = index_value;
#else /* !ENABLED (JERRY_ESNEXT) */
ecma_value_t index_parameter = index_obj_value;
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_value_t call_value = ecma_op_function_call (locale_func_obj_p,
index_obj_value,
index_parameter,
NULL,
0);
ecma_deref_object (locale_func_obj_p);