class SyntaxTree::Index::EntryComments
interface to lazily parse them out.
backend doesn’t provide comments (since they are dropped) we provide this
we use the instruction sequence backend. Because the instruction sequence
This class handles parsing comments from Ruby source code in the case that
def each(&block)
def each(&block) line = location.line - 1 result = [] while line >= 0 && (comment = file_comments.comments[line]) result.unshift(comment) line -= 1 end result.each(&block) end
def initialize(file_comments, location)
def initialize(file_comments, location) @file_comments = file_comments @location = location end