Skip to content

Commit

Permalink
Set contains_keywords flag for implicit gets($/, chomp: true) method …
Browse files Browse the repository at this point in the history
…call to handle -l CLI option
  • Loading branch information
andrykonchin committed Oct 7, 2024
1 parent 1653317 commit 717e41c
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 @@ -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);
}

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 717e41c

Please sign in to comment.