Skip to content

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

Merged

Conversation

rerobika
Copy link
Member

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
@rerobika rerobika force-pushed the parser_strict_flags branch from ce8ac5d to 58b2512 Compare July 18, 2018 13:36
@@ -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);
Copy link
Member

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.

Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@rerobika rerobika mentioned this pull request Jul 19, 2018
@LaszloLango LaszloLango added this to the Release 2.0 milestone Jul 19, 2018
@LaszloLango LaszloLango added the api Related to the public API label Jul 19, 2018
Copy link
Member

@zherczeg zherczeg left a 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LaszloLango LaszloLango merged commit 77d9314 into jerryscript-project:master Jul 20, 2018
@rerobika rerobika mentioned this pull request Jul 20, 2018
legendecas added a commit to yodaos-project/ShadowNode that referenced this pull request Nov 29, 2018
legendecas added a commit to yodaos-project/ShadowNode that referenced this pull request Nov 29, 2018
legendecas added a commit to yodaos-project/ShadowNode that referenced this pull request Nov 29, 2018
@rerobika rerobika deleted the parser_strict_flags branch February 28, 2019 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants