Skip to content

Commit

Permalink
Merge pull request #1234 from barfeous/bugs/augmentedGraphView
Browse files Browse the repository at this point in the history
fix: Avoid modifying augmented graph view collection upon traversal
  • Loading branch information
AsakusaRinne authored Apr 29, 2024
2 parents 27a9e91 + 4a31621 commit 8775b0b
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ private ConcreteFunction maybe_uncache_variable_captures(ConcreteFunction concre

public override (IList<Trackable>, IDictionary<Trackable, IEnumerable<TrackableReference>>) breadth_first_traversal()
{
Trackable get_merged_trackable(Trackable x)
void merged_trackable(Trackable x)
{
// TODO: complete it with new definitions `Asset` and `TrackableConstant`.
return x;
}

var trackable_objects = base.breadth_first_traversal();

foreach(var obj in _children_cache.Keys)
{
// skip the deletion of cache (maybe do it later).
foreach(var pair in _children_cache[obj])
{
_children_cache[obj][pair.Key] = get_merged_trackable(pair.Value);
merged_trackable(pair.Value);
}
}

Expand All @@ -109,15 +109,11 @@ Trackable get_merged_trackable(Trackable x)

public List<(string, Trackable)> list_dependencies(Trackable obj)
{
IDictionary<string, Trackable> children;
if (!_children_cache.ContainsKey(obj))
if (!_children_cache.TryGetValue(obj, out var children))
{
children= new Dictionary<string, Trackable>();
}
else
{
children= _children_cache[obj];
}

List<(string, Trackable)> res = new();
foreach(var pair in obj.deserialization_dependencies(children))
{
Expand Down

0 comments on commit 8775b0b

Please sign in to comment.