Skip to content

Commit

Permalink
Revert "Ensure all parent nodes fully encompass their child nodes"
Browse files Browse the repository at this point in the history
This reverts commit dd17d97.
  • Loading branch information
Rob Stryker committed Dec 10, 2024
1 parent 0615a26 commit 76b8466
Showing 1 changed file with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -772,20 +772,11 @@ public Void visitClass(ClassTree node, Void p) {
@Override
public void postVisit(ASTNode node) { // fix some positions
if( node.getParent() != null ) {
int myStart = node.getStartPosition();
int myEnd = myStart + node.getLength();
int parentStart = node.getParent().getStartPosition();
int parentEnd = parentStart + node.getParent().getLength();
int newParentStart = parentStart;
int newParentEnd = parentEnd;
if( myStart >= 0 && myStart < parentStart) {
newParentStart = myStart;
}
if( myStart >= 0 && myEnd > parentEnd) {
newParentEnd = myEnd;
}
if( parentStart != newParentStart || parentEnd != newParentEnd) {
node.getParent().setSourceRange(newParentStart, newParentEnd - newParentStart);
if( node.getStartPosition() < node.getParent().getStartPosition()) {
int parentEnd = node.getParent().getStartPosition() + node.getParent().getLength();
if( node.getStartPosition() >= 0 ) {
node.getParent().setSourceRange(node.getStartPosition(), parentEnd - node.getStartPosition());
}
}
}
}
Expand Down

0 comments on commit 76b8466

Please sign in to comment.