From fe2ada80ba05ad20e939cf3d618907067cea1547 Mon Sep 17 00:00:00 2001 From: Pouryafard75 Date: Fri, 6 Dec 2024 14:18:59 -0500 Subject: [PATCH] ASTDiff: TreeUtilFunction look ahead bug fix --- .../org/refactoringminer/astDiff/utils/TreeUtilFunctions.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/refactoringminer/astDiff/utils/TreeUtilFunctions.java b/src/main/java/org/refactoringminer/astDiff/utils/TreeUtilFunctions.java index e9da2e4215..7b5b433e98 100644 --- a/src/main/java/org/refactoringminer/astDiff/utils/TreeUtilFunctions.java +++ b/src/main/java/org/refactoringminer/astDiff/utils/TreeUtilFunctions.java @@ -28,7 +28,8 @@ public class TreeUtilFunctions { public static Tree findByLocationInfo(Tree tree, LocationInfo locationInfo){ int start_offset = locationInfo.getStartOffset(); - if (tree.getPos() > start_offset) return (tree.getParent() != null) ? findByLocationInfo(tree.getParent(),locationInfo) : null; + int end_offset = locationInfo.getEndOffset(); + if (tree.getPos() > start_offset || tree.getEndPos() < end_offset) return (tree.getParent() != null) ? findByLocationInfo(tree.getParent(),locationInfo) : null; return findByLocationInfoNoLookAhead(tree, locationInfo); }