Skip to content

Commit

Permalink
[fix] Don't unset source position twice
Browse files Browse the repository at this point in the history
  • Loading branch information
slarse committed Mar 18, 2020
1 parent ee79bb2 commit 9484de2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/se/kth/spork/cli/PrinterPreprocessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ public void scan(CtElement element) {
*
* The reason for this can be found in
* {@link spoon.reflect.visitor.ElementPrinterHelper#getComments(CtElement, CommentOffset)}.
*
* If the position is all ready {@link SourcePosition#NOPOSITION}, then do nothing.
*/
private static void unsetSourcePosition(CtElement element) {
if (element.getPosition() == SourcePosition.NOPOSITION)
return;

element.putMetadata(POSITION_KEY, element.getPosition());
element.setPosition(SourcePosition.NOPOSITION);
}
Expand Down

0 comments on commit 9484de2

Please sign in to comment.