Skip to content

Commit

Permalink
Merge pull request #3145 from andrykonchin/ak/fix-handling-of-l-cli-o…
Browse files Browse the repository at this point in the history
…ption

Set contains_keywords flag for implicit gets($/, chomp: true) method to handle -l CLI option
  • Loading branch information
kddnewton authored Oct 7, 2024
2 parents d4a93ad + 717e41c commit c38df36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -21907,6 +21907,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);
}

pm_statements_node_t *wrapped_statements = pm_statements_node_create(parser);
Expand Down
3 changes: 3 additions & 0 deletions test/prism/api/command_line_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def test_command_line_l
assert_kind_of CallNode, predicate
assert_equal :gets, predicate.name

arguments = predicate.arguments
assert arguments.contains_keywords?

arguments = predicate.arguments.arguments
assert_equal 2, arguments.length
assert_equal :$/, arguments.first.name
Expand Down

0 comments on commit c38df36

Please sign in to comment.