//A move looks like a deleted method and then an added method in // another place, this find the added methods private static IEnumerable <MethodDeclarationSyntax> GetInsertedMethods(IEnumerable <Diff> diffs) { return(diffs .Where(diff => TriviaCompare.IsSpanInNodeTrivia(diff.Ancestor.Span, diff.Ancestor.Node)) .Select(diff => diff.Changed.Node as MethodDeclarationSyntax) .Where(node => node != null).CacheEnumerable()); }
private static InnerMethodConflict GetInnerMethodConflicts(MethodDeclarationSyntax ancestor, SpanDetails changed, SpanDetails removed, IEnumerable <MethodDeclarationSyntax> insertedMethods, InnerMethodConflict.Local type) { if (!TriviaCompare.IsSpanInNodeTrivia(removed.Span, removed.Node)) { return(null); } var change = changed.Node as MethodDeclarationSyntax; if (change == null) { return(null); } var moved = GetMovedMethod(insertedMethods, change); if (moved == null) { return(null); } var diffRes = Diff3.Compare(ancestor, moved, change); return(new InnerMethodConflict(ancestor, change, moved, diffRes, type)); }