Simplify source evaluation options. (#2431)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2018-07-20 08:50:39 +02:00
committed by László Langó
parent 76ff084dc7
commit 77d9314b1d
26 changed files with 88 additions and 79 deletions
+12 -11
View File
@@ -45,8 +45,7 @@
*/
ecma_value_t
ecma_op_eval (ecma_string_t *code_p, /**< code string */
bool is_direct, /**< is eval called directly (ECMA-262 v5, 15.1.2.1.1) */
bool is_called_from_strict_mode_code) /**< is eval is called from strict mode code */
uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
ecma_value_t ret_value;
@@ -61,8 +60,7 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
ret_value = ecma_op_eval_chars_buffer (code_utf8_buffer_p,
chars_num,
is_direct,
is_called_from_strict_mode_code);
parse_opts);
ECMA_FINALIZE_UTF8_STRING (code_utf8_buffer_p, code_utf8_buffer_size);
}
@@ -82,15 +80,19 @@ ecma_op_eval (ecma_string_t *code_p, /**< code string */
ecma_value_t
ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters buffer */
size_t code_buffer_size, /**< size of the buffer */
bool is_direct, /**< is eval called directly (ECMA-262 v5, 15.1.2.1.1) */
bool is_called_from_strict_mode_code) /**< is eval is called from strict mode code */
uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
#ifndef JERRY_DISABLE_JS_PARSER
JERRY_ASSERT (code_p != NULL);
ecma_compiled_code_t *bytecode_data_p;
bool is_strict_call = (is_direct && is_called_from_strict_mode_code);
uint32_t is_strict_call = ECMA_PARSE_STRICT_MODE | ECMA_PARSE_DIRECT_EVAL;
if ((parse_opts & is_strict_call) != is_strict_call)
{
parse_opts &= (uint32_t) ~ECMA_PARSE_STRICT_MODE;
}
#ifdef JERRY_ENABLE_LINE_INFO
JERRY_CONTEXT (resource_name) = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
@@ -100,7 +102,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
0,
code_p,
code_buffer_size,
is_strict_call,
parse_opts,
&bytecode_data_p);
if (ECMA_IS_VALUE_ERROR (parse_status))
@@ -108,12 +110,11 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
return parse_status;
}
return vm_run_eval (bytecode_data_p, is_direct);
return vm_run_eval (bytecode_data_p, parse_opts);
#else /* JERRY_DISABLE_JS_PARSER */
JERRY_UNUSED (code_p);
JERRY_UNUSED (code_buffer_size);
JERRY_UNUSED (is_direct);
JERRY_UNUSED (is_called_from_strict_mode_code);
JERRY_UNUSED (parse_opts);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
#endif /* !JERRY_DISABLE_JS_PARSER */
+2 -3
View File
@@ -26,11 +26,10 @@
*/
ecma_value_t
ecma_op_eval (ecma_string_t *code_p, bool is_direct, bool is_called_from_strict_mode_code);
ecma_op_eval (ecma_string_t *code_p, uint32_t parse_opts);
ecma_value_t
ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, size_t code_buffer_size, bool is_direct,
bool is_called_from_strict_mode_code);
ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, size_t code_buffer_size, uint32_t parse_opts);
/**
* @}
@@ -566,7 +566,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t ret_value = vm_run (bytecode_data_p,
this_binding,
local_env_p,
false,
ECMA_PARSE_NO_OPTS,
arguments_list_p,
arguments_list_len);
@@ -629,7 +629,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t ret_value = vm_run (bytecode_data_p,
arrow_func_p->this_binding,
local_env_p,
false,
ECMA_PARSE_NO_OPTS,
arguments_list_p,
arguments_list_len);