Don't crash with #comment after =begin/=end #578

wants to merge 1 commit into

2 participants


I encountered this on a large, complex piece of code at work that used =begin/=end followed by a regular comment. YARD tried to append one to the other and died with an exception. This pull request seems to fix it, as does adding a newline between =end and the next comment.

Here is the offending excerpt:


if( encodeParams['MuxFormat'].nil? )
raise "Must specify muxing format"
@muxFormats = @muxFormats + encodeParams['MuxFormat'] + ','

#optional params

@lsegal lsegal added a commit that closed this pull request Aug 7, 2012
@lsegal Properly handle embedded doc comments (=begin/=end)
Fixes #577
Closes #578
@lsegal lsegal closed this in 810505b Aug 7, 2012

FYI a379c8a has some test cases to ensure we get the right comment attached to the node. That part was actually unrelated to this embdoc bug, but this issue brought that problem to light.

Thanks for your patch, @noahgibbs, but it turns out checking range only hides the symptom, it doesn't solve the root of the problem, which was that embedded doc comments didn't have a range. This patch fixes that.


Ah, perfect. Thanks! I was having trouble building a test case that failed before and succeeded after my change, and that's probably why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment