-
Notifications
You must be signed in to change notification settings - Fork 684
Simplify source evaluation options. #2431
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure this is correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's an equivalent conversion. In the previous version the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
{ | ||
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,20 +102,19 @@ 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)) | ||
{ | ||
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 */ | ||
|
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.
If this is an api change please add it to #2213.
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.
Thanks I've added it.