Skip to content

Commit 12916c6

Browse files
committed
Fix minor implementation issues found in the JerryScript API.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
1 parent 8d69e26 commit 12916c6

File tree

4 files changed

+127
-104
lines changed

4 files changed

+127
-104
lines changed

docs/02.API-REFERENCE.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ jerry_run_simple (const jerry_char_t *script_source,
379379

380380
**Summary**
381381

382-
Parse specified script to execute in Global scope.
382+
Parse script and construct an EcmaScript function. The
383+
lexical environment is set to the global lexical environment.
383384

384385
*Note*: Returned value must be freed with [jerry_release_value](#jerry_release_value) when it
385386
is no longer needed.
@@ -425,7 +426,7 @@ jerry_parse (const jerry_char_t *source_p,
425426

426427
**Summary**
427428

428-
Run code in Global scope.
429+
Run an EcmaScript function created by jerry_parse.
429430

430431
*Note*: The code should be previously parsed with `jerry_parse`.
431432

@@ -1102,7 +1103,7 @@ jerry_get_number_value (const jerry_value_t value);
11021103

11031104
**Summary**
11041105

1105-
Get the size of a string. Returns zero, if the specified string is not a value.
1106+
Get the size of a string. Returns zero, if the value parameter is not a string.
11061107

11071108
**Prototype**
11081109

@@ -1138,7 +1139,7 @@ jerry_get_string_size (const jerry_value_t value);
11381139

11391140
**Summary**
11401141

1141-
Get the length of a string. Returns zero, if the specified string is not a value.
1142+
Get the length of a string. Returns zero, if the value parameter is not a string.
11421143

11431144
**Prototype**
11441145

@@ -1175,10 +1176,10 @@ jerry_get_string_length (const jerry_value_t value);
11751176

11761177
**Summary**
11771178

1178-
Copy string characters to specified buffer. It is the caller's responsibility to make sure that
1179-
the string fits in the buffer.
1180-
1181-
*Note*: '\0' could occur in characters.
1179+
Copy the characters of a string into a specified buffer. The
1180+
'\0' character could occur in character buffer. Returns 0,
1181+
if the value parameter is not a string or the buffer is
1182+
not large enough for the whole string.
11821183

11831184
**Prototype**
11841185

@@ -1933,7 +1934,7 @@ jerry_create_undefined (void);
19331934

19341935
**Summary**
19351936

1936-
Checks whether the object or it's prototype has the given property.
1937+
Checks whether the object or it's prototype objects have the given property.
19371938

19381939
**Prototype**
19391940

@@ -2436,7 +2437,8 @@ jerry_free_property_descriptor_fields (const jerry_property_descriptor_t *prop_d
24362437

24372438
**Summary**
24382439

2439-
Call function specified by a function value.
2440+
Call function specified by a function value. Error flag
2441+
must not be set for any arguments of this function.
24402442

24412443
*Note*: Returned value must be freed with [jerry_release_value](#jerry_release_value) when it
24422444
is no longer needed.
@@ -2492,6 +2494,7 @@ jerry_call_function (const jerry_value_t func_obj_val,
24922494
**Summary**
24932495

24942496
Construct object, invoking specified function object as constructor.
2497+
Error flag must not be set for any arguments of this function.
24952498

24962499
*Note*: Returned value must be freed with [jerry_release_value](#jerry_release_value) when it
24972500
is no longer needed.
@@ -2704,13 +2707,14 @@ jerry_get_object_native_handle (const jerry_value_t obj_val,
27042707

27052708
**Summary**
27062709

2707-
Set native handle and, optionally, free callback for the specified object
2710+
Set native handle and an optional free callback for the specified object
27082711

27092712
*Note*: If native handle was already set for the object, its value is updated.
27102713

2711-
*Note*: If free callback is specified, it is set to be called upon specified JS-object is freed (by GC).
2712-
Otherwise, if NULL is specified for free callback pointer, free callback is not created and, if
2713-
a free callback was added earlier for the object, it is removed.
2714+
*Note*: If a non-NULL free callback is specified, it will be called
2715+
by the garbage collector when the object is freed. The free
2716+
callback always overwrites the previous value, so passing
2717+
a NULL value deletes the current free callback.
27142718

27152719
**Prototype**
27162720

jerry-core/ecma/operations/ecma-lex-env.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@ ecma_finalize_environment (void)
7070

7171
/**
7272
* Get reference to Global lexical environment
73+
* without increasing its reference count.
7374
*
7475
* @return pointer to the object's instance
7576
*/
7677
ecma_object_t *
7778
ecma_get_global_environment (void)
7879
{
79-
ecma_ref_object (ecma_global_lex_env_p);
80-
8180
return ecma_global_lex_env_p;
8281
} /* ecma_get_global_environment */
8382

0 commit comments

Comments
 (0)