private int CountNodesForInsertion(ScopeNode[] nodes)
{
int length = nodes.Length;
Stack<ScopeNode> stack = new Stack<ScopeNode>();
for (int i = 0; i < nodes.Length; i++)
{
ScopeNode item = nodes[i];
if (item.Children.Count > 0)
{
stack.Push(item);
}
}
while (stack.Count > 0)
{
ScopeNode node2 = stack.Pop();
length += node2.Children.Count;
foreach (ScopeNode node3 in node2.Children)
{
if (node3.Children.Count > 0)
{
stack.Push(node3);
}
}
}
return length;
}