in DataExtraction/SourceGraphExtractionUtils/Utils/DataFlowGraph.cs [471:518]
private void VisitTypeDeclaration(TypeDeclarationSyntax node)
{
_varToLastUsesStack.Push(new Dictionary<string, HashSet<SyntaxNode>>());
_varToLastWritesStack.Push(new Dictionary<string, HashSet<SyntaxNode>>());
//As C# isn't being picky about order of declarations, we re-order things here. First we declare fields, properties, then we run all constructors in parallel, then we do all the others.
var fieldMemberIndices = new HashSet<int>();
var propertyMemberIndices = new HashSet<int>();
var constructorMemberIndices = new HashSet<int>();
for (int i = 0; i < node.Members.Count; ++i)
{
var curMember = node.Members[i];
if (curMember is FieldDeclarationSyntax)
{
fieldMemberIndices.Add(i);
}
else if (curMember is PropertyDeclarationSyntax)
{
propertyMemberIndices.Add(i);
}
else if (curMember is ConstructorDeclarationSyntax)
{
constructorMemberIndices.Add(i);
}
}
foreach (var fieldDecl in fieldMemberIndices.Select(i => node.Members[i]))
{
Visit(fieldDecl);
}
foreach (var propertyDecl in propertyMemberIndices.Select(i => node.Members[i]))
{
Visit(propertyDecl);
}
var constructorHandlers = constructorMemberIndices.Select<int, Action>(i => (() => Visit(node.Members[i])));
HandleParallelBlocks(constructorHandlers, maySkip: constructorMemberIndices.Count == 0);
for (int i = 0; i < node.Members.Count; ++i)
{
if (!(fieldMemberIndices.Contains(i) || propertyMemberIndices.Contains(i) || constructorMemberIndices.Contains(i)))
{
Visit(node.Members[i]);
}
}
_varToLastUsesStack.Pop();
_varToLastWritesStack.Pop();
}