-
Notifications
You must be signed in to change notification settings - Fork 139
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
Set contains_keywords flag for implicit gets($/, chomp: true) method to handle -l CLI option #3145
Set contains_keywords flag for implicit gets($/, chomp: true) method to handle -l CLI option #3145
Conversation
@@ -21905,6 +21905,7 @@ wrap_statements(pm_parser_t *parser, pm_statements_node_t *statements) { | |||
)); | |||
|
|||
pm_arguments_node_arguments_append(arguments, (pm_node_t *) keywords); | |||
pm_node_flag_set((pm_node_t *) arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS); |
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.
Wondering if it's better to set this flag in pm_arguments_node_arguments_append
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.
That's okay, I think this is fine here.
@@ -21905,6 +21905,7 @@ wrap_statements(pm_parser_t *parser, pm_statements_node_t *statements) { | |||
)); | |||
|
|||
pm_arguments_node_arguments_append(arguments, (pm_node_t *) keywords); | |||
pm_node_flag_set((pm_node_t *) arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS); |
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.
Also wondering if there is a convenient place for a test for this case - fixing an issue without adding tests seems wrong to me.
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.
Yeah, could you put this in command_line_test.rb
?
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.
Yeah, will add the test.
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.
Approve, but if you don't mind adding a quick test that would be good
@@ -21905,6 +21905,7 @@ wrap_statements(pm_parser_t *parser, pm_statements_node_t *statements) { | |||
)); | |||
|
|||
pm_arguments_node_arguments_append(arguments, (pm_node_t *) keywords); | |||
pm_node_flag_set((pm_node_t *) arguments, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS); |
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.
Yeah, could you put this in command_line_test.rb
?
…call to handle -l CLI option
85fb122
to
717e41c
Compare
I suppose the
contains_keywords
flag is missing here because arguments contain keyword argumentschomp: true
.Examples before and after:
bin/prism parse -n -l -e 'puts $_.end_with?("\n")'
AST before:
AST after: