Clean up property existence check inconsistencies (#1860)

`jerry_has_property ()` and `jerry_has_own_property ()` are inconsistent
in that they squash their return value into a `bool` when in fact it is
a `jerry_value_t`, thereby giving the wrong impression that a property
is there when it isn't and encouraging the leaking of `jerry_value_t`s
by disguising them as `bool`s.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1859

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
This commit is contained in:
Gabriel "_|Nix|_" Schulhof
2017-05-29 16:54:32 +03:00
committed by László Langó
parent b51b6824bb
commit 708b155f38
4 changed files with 92 additions and 11 deletions
+2 -2
View File
@@ -1424,7 +1424,7 @@ jerry_substring_to_utf8_char_buffer (const jerry_value_t value, /**< input strin
* @return true - if the property exists
* false - otherwise
*/
bool
jerry_value_t
jerry_has_property (const jerry_value_t obj_val, /**< object value */
const jerry_value_t prop_name_val) /**< property name (string value) */
{
@@ -1448,7 +1448,7 @@ jerry_has_property (const jerry_value_t obj_val, /**< object value */
* @return true - if the property exists
* false - otherwise
*/
bool
jerry_value_t
jerry_has_own_property (const jerry_value_t obj_val, /**< object value */
const jerry_value_t prop_name_val) /**< property name (string value) */
{