Fix the return value of jerry_to_property_descriptor function (#4371)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-01-07 11:09:07 +01:00
committed by GitHub
parent cab266f21d
commit 7baaafa405
5 changed files with 39 additions and 38 deletions
+9 -6
View File
@@ -4071,12 +4071,13 @@ This API function is equivalent to ToPropertyDescriptor operation defined in ECM
It decodes the ECMAScript object and fills the fields of a JerryScript property descriptor.
*Notes*:
- The es.next profile enables this by default.
- Returned value must be freed with [jerry_release_value](#jerry_release_value) when it
is no longer needed.
**Prototype**
```c
bool
jerry_value_t
jerry_to_property_descriptor (jerry_value_t obj_value, jerry_property_descriptor_t *out_prop_desc_p);
```
@@ -4084,8 +4085,10 @@ jerry_to_property_descriptor (jerry_value_t obj_value, jerry_property_descriptor
- `src_prop_desc_p` - the output property descriptor.
- return
- [jerry_value_t](#jerry_value_t)
- true - if success
- false - if error occurs
- true, if success
- thrown error, otherwise
*New in version [[NEXT_RELEASE]]*.
**Example**
@@ -4102,9 +4105,9 @@ example (void)
jerry_value_t value = jerry_create_boolean (true);
jerry_property_descriptor_t prop_desc;
jerry_set_property (object, prop_name, prop_name);
jerry_release_value (jerry_set_property (object, prop_name, prop_name));
jerry_to_property_descriptor (object, &prop_desc);
jerry_release_value (jerry_to_property_descriptor (object, &prop_desc));
jerry_release_value (object);
jerry_release_value (prop_name);