Consistently name comment own line/end-of-line line_position() (#5215)

## Summary

Previously, `DecoratedComment` used `text_position()` and
`SourceComment` used `position()`. This PR unifies this to
`line_position` everywhere.

## Test Plan

This is a rename refactoring.
This commit is contained in:
konstin
2023-06-21 11:04:56 +02:00
committed by GitHub
parent 1336ca601b
commit db301c14bd
9 changed files with 53 additions and 52 deletions

View File

@@ -136,7 +136,7 @@ impl Format<PyFormatContext<'_>> for FormatTrailingComments<'_> {
{
let slice = trailing.slice();
has_trailing_own_line_comment |= trailing.position().is_own_line();
has_trailing_own_line_comment |= trailing.line_position().is_own_line();
if has_trailing_own_line_comment {
let lines_before_comment = lines_before(slice.start(), f.context().contents());
@@ -208,7 +208,7 @@ impl Format<PyFormatContext<'_>> for FormatDanglingComments<'_> {
.iter()
.filter(|comment| comment.is_unformatted())
{
if first && comment.position().is_end_of_line() {
if first && comment.line_position().is_end_of_line() {
write!(f, [space(), space()])?;
}