lib/rubocop/cop/layout/class_structure.rb in rubocop-0.52.0 vs lib/rubocop/cop/layout/class_structure.rb in rubocop-0.52.1
- old
+ new
@@ -262,11 +262,11 @@
end_line = buffer.line_for_position(node.loc.expression.end_pos)
buffer.line_range(end_line).end_pos
end
def begin_pos_with_comment(node)
- annotation_line = node.loc.line - 1
+ annotation_line = node.first_line - 1
first_comment = nil
comments_before_line(annotation_line).reverse_each do |comment|
if comment.location.line == annotation_line
first_comment = comment
@@ -276,10 +276,10 @@
start_line_position(first_comment || node)
end
def start_line_position(node)
- buffer.line_range(node.loc.line).begin_pos - 1
+ buffer.line_range(node.first_line).begin_pos - 1
end
def comments_before_line(line)
processed_source.comments.select { |c| c.location.line <= line }
end