Skip to content

Commit bf7232a

Browse files
authored
SONARPY-2435 Fix broken build after merging (#2228)
1 parent 6060554 commit bf7232a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

python-frontend/src/main/java/org/sonar/python/tree/TreeUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static Tree firstAncestorOfKind(Tree tree, Kind... kinds) {
9696
}
9797

9898
public static Comparator<Tree> getTreeByPositionComparator() {
99-
return Comparator.comparing((Tree t) -> t.firstToken().pythonLine()).thenComparing((Tree t) -> t.firstToken().pythonColumn());
99+
return Comparator.comparing((Tree t) -> t.firstToken().pythonLine().line()).thenComparing((Tree t) -> t.firstToken().pythonColumn());
100100
}
101101

102102
public static List<Token> tokens(Tree tree) {
@@ -256,7 +256,7 @@ public static int findIndentationSize(Tree tree) {
256256
var treeToken = tree.firstToken();
257257
var parentToken = parent.firstToken();
258258

259-
if (treeToken.pythonLine() != parentToken.pythonLine()) {
259+
if (treeToken.pythonLine().line() != parentToken.pythonLine().line()) {
260260
return treeToken.pythonColumn() - parentToken.pythonColumn();
261261
} else {
262262
return findIndentationSize(parent);
@@ -270,7 +270,7 @@ private static int findIndentDownTree(Tree parent) {
270270
.map(child -> {
271271

272272
var childToken = child.firstToken();
273-
if (childToken.pythonLine() > parentToken.pythonLine() && childToken.pythonColumn() > parentToken.pythonColumn()) {
273+
if (childToken.pythonLine().line() > parentToken.pythonLine().line() && childToken.pythonColumn() > parentToken.pythonColumn()) {
274274
return childToken.pythonColumn() - parentToken.pythonColumn();
275275
} else {
276276
return findIndentDownTree(child);
@@ -477,8 +477,8 @@ public static Optional<Tree> firstChild(Tree tree, Predicate<Tree> filter) {
477477

478478
public static String treeToString(Tree tree, boolean renderMultiline) {
479479
if (!renderMultiline) {
480-
var firstLine = tree.firstToken().pythonLine();
481-
var lastLine = tree.lastToken().pythonLine();
480+
var firstLine = tree.firstToken().pythonLine().line();
481+
var lastLine = tree.lastToken().pythonLine().line();
482482

483483
// We decided to not support multiline default parameters
484484
// because it requires indents calculation for place where the value should be copied.

0 commit comments

Comments
 (0)