Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid modifying augmented graph view collection upon traversal #1234

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading