Skip to content
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

[PRISM] Fix segv with regex once flag #9207

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@ pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
RUBY_ASSERT(node->flags & PM_REGULAR_EXPRESSION_FLAGS_ONCE);
scope->body = (pm_node_t *)node;
scope->local_depth_offset += 1;
break;
}
case PM_LAMBDA_NODE: {
Expand Down
1 change: 1 addition & 0 deletions test/ruby/test_compile_prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ def test_RegularExpressionNode
assert_prism_eval('/pit/ne')

assert_prism_eval('2.times.map { /#{1}/o }')
assert_prism_eval('2.times.map { foo = 1; /#{foo}/o }')
end

def test_StringNode
Expand Down