[ruby/prism] Use correct opening and closing parenthesis for array pattern in parser

https://github.com/ruby/prism/commit/beed43922c
This commit is contained in:
Kevin Newton 2024-05-31 14:26:38 -04:00 committed by git
parent 47f05dffa1
commit 1b392ba7c6
2 changed files with 6 additions and 3 deletions

View File

@ -90,7 +90,11 @@ module Prism
end
if node.constant
builder.const_pattern(visit(node.constant), token(node.opening_loc), builder.array_pattern(nil, visited, nil), token(node.closing_loc))
if visited.empty?
builder.const_pattern(visit(node.constant), token(node.opening_loc), builder.array_pattern(token(node.opening_loc), visited, token(node.closing_loc)), token(node.closing_loc))
else
builder.const_pattern(visit(node.constant), token(node.opening_loc), builder.array_pattern(nil, visited, nil), token(node.closing_loc))
end
else
builder.array_pattern(token(node.opening_loc), visited, token(node.closing_loc))
end

View File

@ -59,7 +59,6 @@ module Prism
"seattlerb/block_decomp_splat.txt",
"seattlerb/block_paren_splat.txt",
"seattlerb/bug190.txt",
"seattlerb/case_in.txt",
"seattlerb/heredoc_nested.txt",
"seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt",
"seattlerb/heredoc_with_carriage_return_escapes_windows.txt",
@ -69,7 +68,6 @@ module Prism
"seattlerb/heredoc_with_only_carriage_returns.txt",
"seattlerb/masgn_double_paren.txt",
"seattlerb/parse_line_heredoc_hardnewline.txt",
"seattlerb/parse_pattern_044.txt",
"seattlerb/pct_nl.txt",
"seattlerb/pctW_lineno.txt",
"seattlerb/regexp_esc_C_slash.txt",
@ -108,6 +106,7 @@ module Prism
"xstring_with_backslash.txt",
"seattlerb/backticks_interpolation_line.txt",
"seattlerb/bug169.txt",
"seattlerb/case_in.txt",
"seattlerb/class_comments.txt",
"seattlerb/difficult4__leading_dots2.txt",
"seattlerb/difficult6__7.txt",