-
Notifications
You must be signed in to change notification settings - Fork 683
Jerry API update #1177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jerry API update #1177
Conversation
@@ -2265,24 +2264,22 @@ parser_parse_script (const jerry_char_t *source_p, /**< source code */ | |||
* Note: | |||
* returned error object should be freed with jerry_release_object | |||
*/ | |||
jsp_status_t | |||
parser_parse_eval (const jerry_char_t *source_p, /**< source code */ | |||
ecma_object_t * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer return with an ecma_value_t.
const jerry_value_t); | ||
|
||
jerry_value_t jerry_function_call (const jerry_value_t, const jerry_value_t, const jerry_value_t[], jerry_size_t); | ||
jerry_value_t jerry_object_construct (const jerry_value_t, const jerry_value_t[], jerry_size_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use function_call and construct_object
@jimmy-huang @grgustaf FYI changes coming. PTAL. |
One of @zherczeg 's comments above reminded me, it seems odd that jerry_get_array_length returns uint32_t but [gs]et_array_index_value take jerry_length_t. But I'll admit the myriad aliases for ints confuse me. Is that as it should be? |
|
||
/** | ||
* General API functions of JS objects | ||
*/ | ||
bool jerry_is_array (const jerry_object_t *); | ||
bool jerry_is_constructor (const jerry_object_t *); | ||
bool jerry_is_function (const jerry_object_t *); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing these 3 jerry_is_* functions? How to use the new API to achieve the same functionality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are new functions ofr that:
bool jerry_value_is_array (const jerry_value_t);
the point is we don't export the real types of values anymore, all of them are jerry_value_t
01abb96
to
dba42e0
Compare
|
||
/** | ||
* Get the global context | ||
*/ | ||
jerry_object_t *jerry_get_global (void); | ||
jerry_value_t jerry_get_global (void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use jerry_get_global_object since it is not clear that global is an object anymore.
prop_desc_p->is_set_defined = prop_desc.is_set_defined; | ||
prop_desc_p->is_value_defined = prop_desc.is_value_defined; | ||
|
||
prop_desc_p->getter = ecma_make_object_value (prop_desc.get_p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_getter defined? NULL check?
607dbb0
to
5a594dd
Compare
|
||
Pointers to strings or objects and values should be released just when become unnecessary, using `jerry_release_string` or `jerry_release_object` and `jerry_release_value`, correspondingly. | ||
JerryScript value can be a boolean, number, null, object, string or undefined. The value has an error flag, | ||
that indicates whether is an error or not. Every type can be an error not only objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every type has an error flag not only objects.
I think this is a great job! |
79a7a19
to
67147cb
Compare
|
||
Pointers to strings or objects and values should be released just when become unnecessary, using `jerry_release_string` or `jerry_release_object` and `jerry_release_value`, correspondingly. | ||
JerryScript value can be a boolean, number, null, object, string or undefined. The value has an error flag, | ||
that indicates whether is an error or not. Every type has an error flag not only objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should also be noted that the error flag should be cleared before the value is passed as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that created error objects automatically have the flag set.
LGTM otherwise. |
67147cb
to
bc0b7af
Compare
* Removed jerry_string_t and jerry_object_t * Updated function names * Updated return values * Updated function descriptions * Added new functions * Added new unittests JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected]
bc0b7af
to
9bce5b0
Compare
@LaszloLango Hi, can I assume that it is the API 1.0, and will not change a lot in this period? |
We are hoping this API will be stable. Perhaps we add more functions, but not removing them. Unless something serious comes up. Hopefully not. |
Thanks! and is our next step is Jerry Port API #964?:) |
@jiangzidong, yes. Port API patch will be the next :) |
No description provided.