зеркало из https://github.com/github/ruby.git
[Bug #19399] Parsing invalid heredoc inside block parameter
Although this is of course invalid as Ruby code, allow to just parse and tokenize.
This commit is contained in:
Родитель
f499c81b01
Коммит
fad48fefe1
|
@ -228,7 +228,7 @@ class Ripper
|
|||
|
||||
def on_heredoc_end(tok)
|
||||
@buf.push Elem.new([lineno(), column()], __callee__, tok, state())
|
||||
@buf = @stack.pop
|
||||
@buf = @stack.pop unless @stack.empty?
|
||||
end
|
||||
|
||||
def _push_token(tok)
|
||||
|
|
|
@ -252,4 +252,16 @@ world"
|
|||
]
|
||||
assert_equal(code, Ripper.tokenize(code).join(""), bug)
|
||||
end
|
||||
|
||||
def test_heredoc_inside_block_param
|
||||
bug = '[Bug #19399]'
|
||||
code = <<~CODE
|
||||
a do |b
|
||||
<<-C
|
||||
C
|
||||
|
|
||||
end
|
||||
CODE
|
||||
assert_equal(code, Ripper.tokenize(code).join(""), bug)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче