Beispiel #1
0
        private static Compilation RemoveGeneratedSyntaxTrees(GeneratorDriverState state, Compilation compilation)
        {
            ArrayBuilder <SyntaxTree> trees = ArrayBuilder <SyntaxTree> .GetInstance();

            foreach (var generatorState in state.GeneratorStates)
            {
                foreach (var tree in generatorState.Trees)
                {
                    if (tree is object && compilation.ContainsSyntaxTree(tree))
                    {
                        trees.Add(tree);
                    }
                }
            }

            var comp = compilation.RemoveSyntaxTrees(trees);

            trees.Free();
            return(comp);
        }