-
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
Simplify source evaluation options. #2431
Conversation
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
ce8ac5d
to
58b2512
Compare
@@ -969,12 +969,12 @@ Perform JavaScript `eval`. | |||
jerry_value_t | |||
jerry_eval (const jerry_char_t *source_p, | |||
size_t source_size, | |||
bool is_strict); | |||
uint32_t parse_opts); |
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's an equivalent conversion. In the previous version the is_strict_call
variable was only true, if both options were true. So it means whether one of the ECMA_PARSE_STRICT_MODE
or ECMA_PARSE_DIRECT_EVAL
flags are not enabled, the script must be executed in non-strict mode.
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.
Ok
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.
LGTM
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
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.
LGTM
Picked from upstream jerryscript-project/jerryscript#2431
Picked from upstream jerryscript-project/jerryscript#2431
Picked from upstream jerryscript-project/jerryscript#2431
Refs: jerryscript-project/jerryscript#2431 Refs: jerryscript-project/jerryscript#2496 Refs: jerryscript-project/jerryscript#2485 Refs: jerryscript-project/jerryscript#2530 Refs: jerryscript-project/jerryscript#2547 Refs: jerryscript-project/jerryscript#2436 Refs: jerryscript-project/jerryscript#2467 Refs: jerryscript-project/jerryscript#2481 Refs: jerryscript-project/jerryscript#2408 Refs: jerryscript-project/jerryscript#2430 Refs: jerryscript-project/jerryscript#2439 Refs: jerryscript-project/jerryscript#2588
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]