fix mutating list while iterating over it
This commit is contained in:
parent
0c7f4a4a56
commit
e7c7f86455
|
@ -107,6 +107,8 @@ struct ModuleCache
|
||||||
*/
|
*/
|
||||||
void removeImportPaths(const string[] paths)
|
void removeImportPaths(const string[] paths)
|
||||||
{
|
{
|
||||||
|
import std.array : array;
|
||||||
|
|
||||||
foreach (path; paths[])
|
foreach (path; paths[])
|
||||||
{
|
{
|
||||||
if (!importPaths[].canFind!(a => a.path == path))
|
if (!importPaths[].canFind!(a => a.path == path))
|
||||||
|
@ -115,7 +117,7 @@ struct ModuleCache
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ref importPath; importPaths[].filter!(a => a.path == path))
|
foreach (ref importPath; importPaths[].filter!(a => a.path == path).array)
|
||||||
importPaths.remove(importPath);
|
importPaths.remove(importPath);
|
||||||
|
|
||||||
foreach (cacheEntry; cache[])
|
foreach (cacheEntry; cache[])
|
||||||
|
|
Loading…
Reference in New Issue