in Backend/Core/ForTea.Core/Psi/Cache/Impl/T4FileDependencyCache.cs [191:224]
private bool UpdateIncluders(
[NotNull] IDictionary<IPsiSourceFile, T4ReversedFileDependencyData> map,
[NotNull] IPsiSourceFile includer,
[NotNull, ItemNotNull] IEnumerable<IPsiSourceFile> allNewIncludes,
[NotNull, ItemNotNull] IEnumerable<IPsiSourceFile> removedIncludes
)
{
var includerLocation = includer.GetLocation();
foreach (var removedInclude in removedIncludes.WhereNotNull())
{
var existingData = map.TryGetValue(removedInclude);
existingData?.Includers.Remove(includerLocation);
if (existingData?.Includers.Count == 0) map.Remove(removedInclude);
}
bool handChange = false;
foreach (var addedInclude in allNewIncludes.WhereNotNull())
{
var existingData = map.TryGetValue(addedInclude);
if (existingData == null)
{
handChange = true;
var includers = new List<VirtualFileSystemPath> { includerLocation };
map[addedInclude] = new T4ReversedFileDependencyData(includers);
}
else if (!existingData.Includers.Contains(includerLocation))
{
handChange = true;
existingData.Includers.Add(includerLocation);
}
}
return handChange;
}