Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed May 5, 2024
1 parent 3fe07a9 commit f6683dd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/org/codetracker/BlockTrackerChangeHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,17 @@ public boolean checkForExtractionOrInline(ArrayDeque<Block> blocks, Version curr
Block blockBefore = Block.of(rightBlock.getComposite(), rightBlock.getOperation(), parentVersion);
if (matchedBlockFromSourceMethod == null) {
blockChangeHistory.handleAdd(blockBefore, rightBlock, extractOperationRefactoring.toString());
blocks.add(blockBefore);
if(extractMatches == 0) {
blocks.add(blockBefore);
}
}
else {
VariableDeclarationContainer sourceOperation = extractOperationRefactoring.getSourceOperationBeforeExtraction();
Method sourceMethod = Method.of(sourceOperation, parentVersion);
Block leftBlock = Block.of(matchedBlockFromSourceMethod, sourceMethod);
blocks.add(leftBlock);
if(extractMatches == 0) {
blocks.add(leftBlock);
}
}
blockChangeHistory.connectRelatedNodes();
extractMatches++;
Expand Down Expand Up @@ -544,7 +548,9 @@ else if (tryBefore.getFinallyClause() != null && tryAfter.getFinallyClause() ==
if (!bodyChange && !catchOrFinallyChange) {
blockChangeHistory.addChange(blockBefore, blockAfter, ChangeFactory.of(AbstractChange.Type.NO_CHANGE));
}
blocks.add(blockBefore);
if(matches == 0) {
blocks.add(blockBefore);
}
blockChangeHistory.connectRelatedNodes();
matches++;
}
Expand All @@ -559,7 +565,9 @@ else if (mapping instanceof LeafMapping && mapping.getFragment2() instanceof Sta
else {
blockChangeHistory.addChange(blockBefore, blockAfter, ChangeFactory.of(AbstractChange.Type.NO_CHANGE));
}
blocks.add(blockBefore);
if(matches == 0) {
blocks.add(blockBefore);
}
blockChangeHistory.connectRelatedNodes();
matches++;
}
Expand Down

0 comments on commit f6683dd

Please sign in to comment.