Skip to content

Commit e7c7f86

Browse files
committed
fix mutating list while iterating over it
1 parent 0c7f4a4 commit e7c7f86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dsymbol/src/dsymbol/modulecache.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ struct ModuleCache
107107
*/
108108
void removeImportPaths(const string[] paths)
109109
{
110+
import std.array : array;
111+
110112
foreach (path; paths[])
111113
{
112114
if (!importPaths[].canFind!(a => a.path == path))
@@ -115,7 +117,7 @@ struct ModuleCache
115117
continue;
116118
}
117119

118-
foreach (ref importPath; importPaths[].filter!(a => a.path == path))
120+
foreach (ref importPath; importPaths[].filter!(a => a.path == path).array)
119121
importPaths.remove(importPath);
120122

121123
foreach (cacheEntry; cache[])

0 commit comments

Comments
 (0)