Skip to content

Improve expected identifier checks. #3064

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
merged 1 commit into from
Sep 5, 2019

Conversation

zherczeg
Copy link
Member

@zherczeg zherczeg commented Sep 5, 2019

Checks for "of" or "from" does not accept quoted strings.

Checks for "of" or "from" does not accept quoted strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
@@ -435,7 +435,8 @@ parser_parse_class_literal (parser_context_t *context_p) /**< context */
is_computed = true;
}
else if (!(status_flags & PARSER_CLASS_STATIC_FUNCTION)
&& lexer_compare_raw_identifier_to_current (context_p, "constructor", 11))
&& LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make sense to have this LEXER_IS_IDENT_OR_STRING in the method? And not as an assert? The other variant of the method correctly checks the types without assert.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a pretty low level function and in the other cases it knows that the type is limited to the allowed types.

Copy link
Contributor

@galpeter galpeter left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@rerobika rerobika left a comment

Choose a reason for hiding this comment

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

LGTM

@rerobika rerobika merged commit 96edec1 into jerryscript-project:master Sep 5, 2019
@zherczeg zherczeg deleted the compare_raw_ident branch September 5, 2019 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants