Fix delete operation in Set objects (#3203)

Delete should return false if an element doesn't exist in a set.
ECMA_VALUE_EMPTY wasn't checked in case of a deleted property.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla 2019-10-07 17:27:34 +03:00 committed by Robert Fancsik
parent eb97860509
commit 7dc2d1dcd7
2 changed files with 5 additions and 1 deletions

View File

@ -573,7 +573,7 @@ ecma_op_container_delete (ecma_value_t this_arg, /**< this argument */
ecma_deref_ecma_string (prop_name_p);
if (property_p == NULL)
if (property_p == NULL || ecma_is_value_empty (ECMA_PROPERTY_VALUE_PTR (property_p)->value))
{
return ECMA_VALUE_FALSE;
}

View File

@ -87,3 +87,7 @@ assert (set.size === 3);
set.clear();
assert(set.size === 0);
set.add(3);
assert(set.delete(3));
assert(!set.delete(3));