fix mutating list while iterating over it

This commit is contained in:
WebFreak001 2022-10-13 17:33:58 +02:00
parent 8259426647
commit f44aa180c3
No known key found for this signature in database
GPG Key ID: AEFC88D11109D1AA
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[])