Skip to content

Commit

Permalink
SONARPY-2435 Fix broken build after merging (#2228)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainpiot authored Dec 9, 2024
1 parent 6060554 commit bf7232a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static Tree firstAncestorOfKind(Tree tree, Kind... kinds) {
}

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

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

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

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

public static String treeToString(Tree tree, boolean renderMultiline) {
if (!renderMultiline) {
var firstLine = tree.firstToken().pythonLine();
var lastLine = tree.lastToken().pythonLine();
var firstLine = tree.firstToken().pythonLine().line();
var lastLine = tree.lastToken().pythonLine().line();

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

0 comments on commit bf7232a

Please sign in to comment.