fix mutating list while iterating over it

This commit is contained in:
WebFreak001 2022-10-13 17:33:58 +02:00 committed by Jan Jurzitza
parent 0c7f4a4a56
commit e7c7f86455
1 changed files with 3 additions and 1 deletions

View File

@ -107,6 +107,8 @@ struct ModuleCache
*/
void removeImportPaths(const string[] paths)
{
import std.array : array;
foreach (path; paths[])
{
if (!importPaths[].canFind!(a => a.path == path))
@ -115,7 +117,7 @@ struct ModuleCache
continue;
}
foreach (ref importPath; importPaths[].filter!(a => a.path == path))
foreach (ref importPath; importPaths[].filter!(a => a.path == path).array)
importPaths.remove(importPath);
foreach (cacheEntry; cache[])