lib/rubocop/cop/layout/empty_comment.rb in rubocop-1.46.0 vs lib/rubocop/cop/layout/empty_comment.rb in rubocop-1.47.0
- old
+ new
@@ -95,13 +95,13 @@
end
def autocorrect(corrector, node)
previous_token = previous_token(node)
range = if previous_token && same_line?(node, previous_token)
- range_with_surrounding_space(node.loc.expression, newlines: false)
+ range_with_surrounding_space(node.source_range, newlines: false)
else
- range_by_whole_lines(node.loc.expression, include_final_newline: true)
+ range_by_whole_lines(node.source_range, include_final_newline: true)
end
corrector.remove(range)
end
@@ -135,10 +135,10 @@
def allow_margin_comment?
cop_config['AllowMarginComment']
end
def current_token(comment)
- processed_source.find_token { |token| token.pos == comment.loc.expression }
+ processed_source.find_token { |token| token.pos == comment.source_range }
end
def previous_token(node)
current_token = current_token(node)
index = processed_source.tokens.index(current_token)