[ruby/prism] Fix parser translator heredoc dedention with leading interpolation
```rb <<~F foo #{} bar F ``` has zero common whitespace. https://github.com/ruby/prism/commit/1f3c222a06
This commit is contained in:
parent
eab1f02149
commit
0a26a3de89
@ -569,6 +569,11 @@ module Prism
|
|||||||
|
|
||||||
# String content inside nested heredocs and interpolation is ignored
|
# String content inside nested heredocs and interpolation is ignored
|
||||||
if next_token.type == :HEREDOC_START || next_token.type == :EMBEXPR_BEGIN
|
if next_token.type == :HEREDOC_START || next_token.type == :EMBEXPR_BEGIN
|
||||||
|
# When interpolation is the first token of a line there is no string
|
||||||
|
# content to check against. There will be no common whitespace.
|
||||||
|
if nesting_level == 0 && next_token.location.start_column == 0
|
||||||
|
result = 0
|
||||||
|
end
|
||||||
nesting_level += 1
|
nesting_level += 1
|
||||||
elsif next_token.type == :HEREDOC_END || next_token.type == :EMBEXPR_END
|
elsif next_token.type == :HEREDOC_END || next_token.type == :EMBEXPR_END
|
||||||
nesting_level -= 1
|
nesting_level -= 1
|
||||||
|
@ -98,7 +98,6 @@ module Prism
|
|||||||
"heredocs_with_ignored_newlines.txt",
|
"heredocs_with_ignored_newlines.txt",
|
||||||
"methods.txt",
|
"methods.txt",
|
||||||
"strings.txt",
|
"strings.txt",
|
||||||
"tilde_heredocs.txt",
|
|
||||||
"seattlerb/backticks_interpolation_line.txt",
|
"seattlerb/backticks_interpolation_line.txt",
|
||||||
"seattlerb/bug169.txt",
|
"seattlerb/bug169.txt",
|
||||||
"seattlerb/case_in.txt",
|
"seattlerb/case_in.txt",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user