Merge pull request #9285 from Lydrin/master

pkg/jerryscript: update to latest commit
This commit is contained in:
Francisco Acosta 2018-06-29 18:14:02 +02:00 committed by GitHub
commit 4b7f85de75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View File

@ -31,30 +31,34 @@
int js_run(const jerry_char_t *script, size_t script_size) int js_run(const jerry_char_t *script, size_t script_size)
{ {
jerry_value_t ret_value;
/* Initialize engine */ jerry_value_t parsed_code, ret_value;
int res = 0;
/* Initialize engine, no flags, default configuration */
jerry_init(JERRY_INIT_EMPTY); jerry_init(JERRY_INIT_EMPTY);
/* Register the print function in the global object. */ /* Register the print function in the global object. */
jerryx_handler_register_global((const jerry_char_t *) "print", jerryx_handler_print);
jerryx_handler_register_global((const jerry_char_t *) "print",
jerryx_handler_print);
/* Setup Global scope code */ /* Setup Global scope code */
ret_value = jerry_parse(script, script_size, false);
if (!jerry_value_has_error_flag(ret_value)) { parsed_code = jerry_parse(NULL, 0, script, script_size, JERRY_PARSE_NO_OPTS);
if (!jerry_value_is_error(parsed_code)) {
/* Execute the parsed source code in the Global scope */ /* Execute the parsed source code in the Global scope */
ret_value = jerry_run(ret_value); ret_value = jerry_run(parsed_code);
if (jerry_value_is_error(ret_value)) {
printf("js_run(): Script Error!");
res = -1;
}
jerry_release_value(ret_value);
} }
int res = 0; jerry_release_value(parsed_code);
if (jerry_value_has_error_flag(ret_value)) {
printf("js_run(): Script Error!");
res = -1;
}
jerry_release_value(ret_value);
/* Cleanup engine */ /* Cleanup engine */
jerry_cleanup(); jerry_cleanup();

View File

@ -1,6 +1,6 @@
PKG_NAME=jerryscript PKG_NAME=jerryscript
PKG_URL=https://github.com/jerryscript-project/jerryscript.git PKG_URL=https://github.com/jerryscript-project/jerryscript.git
PKG_VERSION=bd574956e3702bc5b0512ad835b1df896cf00626 PKG_VERSION=e1af56586cf9beeafbc67172b05cad28eca289cb
PKG_LICENSE=Apache-2.0 PKG_LICENSE=Apache-2.0
.PHONY: all .PHONY: all