cdt/cdt_6_0_x/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
branchRCL_2_4
changeset 128 d00b6e7a8c94
parent 37 c2bce6dd59e7
equal deleted inserted replaced
108:177481f2140d 128:d00b6e7a8c94
   375 			}
   375 			}
   376 		}
   376 		}
   377 	}
   377 	}
   378 
   378 
   379 	private boolean isSameName(IName n1, IName n2) {
   379 	private boolean isSameName(IName n1, IName n2) {
       
   380 		if (n1 == n2)
       
   381 			return true;
       
   382 
   380 		IASTFileLocation loc1 = n1.getFileLocation();
   383 		IASTFileLocation loc1 = n1.getFileLocation();
   381 		IASTFileLocation loc2 = n2.getFileLocation();
   384 		IASTFileLocation loc2 = n2.getFileLocation();
   382 		return loc1.getFileName().equals(loc2.getFileName()) &&
   385 		if (loc1 == null || loc2 == null) {
   383 				loc1.getNodeOffset() == loc2.getNodeOffset() &&
   386 			return false;
   384 				loc1.getNodeLength() == loc2.getNodeLength();
   387 		}
   385 	}
   388 		return loc1.getFileName().equals(loc2.getFileName()) 
       
   389 				&& loc1.getNodeOffset() == loc2.getNodeOffset()
       
   390 				&& loc1.getNodeLength() == loc2.getNodeLength();}
   386 
   391 
   387 	private static boolean isInSameFunction(IASTName name1, IName name2) {
   392 	private static boolean isInSameFunction(IASTName name1, IName name2) {
   388 		IASTDeclaration decl1 = getEnclosingDeclaration(name1);
   393 		IASTDeclaration decl1 = getEnclosingDeclaration(name1);
   389 		IASTDeclaration decl2 = name2 instanceof IASTName ? getEnclosingDeclaration((IASTName) name2) : null;
   394 		IASTDeclaration decl2 = name2 instanceof IASTName ? getEnclosingDeclaration((IASTName) name2) : null;
   390 		return decl1 != null && decl1.equals(decl2) || decl1 == null && decl2 == null;
   395 		return decl1 != null && decl1.equals(decl2) || decl1 == null && decl2 == null;