public CompilationUnitSyntax ComputeRoot(CompilationUnitSyntax root)
        {
            var dependenciesMap = _semanticModel.GetDependenciesTree(_block.Statements);
            var statements      = GetOrderedStatements(dependenciesMap);

            return(root.ReplaceNode(_block, _block.WithStatements(statements.Cast <StatementSyntax>().ToSyntaxList())));
        }
        public CompilationUnitSyntax ComputeRoot(CompilationUnitSyntax root)
        {
            var withChildStatements = _block.Statements.SelectMany(ExpandStatement);
            var dependenciesTree    = _semanticModel.GetDependenciesTree(withChildStatements);
            var injections          = _block.Statements
                                      .Select(st => new InjectionPoint(st, PointToInject(st, dependenciesTree)))
                                      .Where(_ => _.ToPoint != null)
                                      .ToList()
                                      .GroupBy(GetTopLevelParent)
                                      .ToDictionary(_ => _.Key, _ => _.AsEnumerable());

            var newBlock = _block.WithStatements(Inject(injections).ToSyntaxList());

            return(root.ReplaceNode(_block, newBlock));
        }