-
Notifications
You must be signed in to change notification settings - Fork 133
Conversation
src/Analysis/Engine/Impl/Interpreter/Ast/AstAnalysisFunctionWalkerSet.cs
Show resolved
Hide resolved
src/Analysis/Engine/Impl/Interpreter/Ast/AstAnalysisFunctionWalkerSet.cs
Show resolved
Hide resolved
public void ProcessSet() { | ||
// Do not use foreach since walker list is dynamically | ||
// modified and walkers are removed as they are done. | ||
while (_functionWalkers.Count > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var walkers = _functionWalkers.Values.ToArray();
_functionWalkers.Clear();
foreach (var walker in walkers) {
walker.Walk();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the point is in keeping walkers in the array for recursive processing. We don't walk in order. Ex A calls B which calls D which calls C. We take A which then, when it needs return type of B will call ProcessFunction
that needs to find B walker and process it. B walkers will cause ProcessFunction
on D and then on C.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if walker is removed b/c it was called in some chain, we don't want to walk it again so that's why there is no ToArray
Fixes #294