コード例 #1
0
ファイル: GraphBuilder.cs プロジェクト: tmteam/Nfuntic
        public FinalizationResults Solve()
        {
            PrintTrace();
            Console.WriteLine();

            var sorted = Toposort();

            Console.WriteLine("Decycled:");
            PrintTrace();

            Console.WriteLine();
            Console.WriteLine("Set up");

            SolvingFunctions.SetUpwardsLimits(sorted);
            PrintTrace();

            Console.WriteLine();
            Console.WriteLine("Set down");

            SolvingFunctions.SetDownwardsLimits(sorted);
            PrintTrace();

            SolvingFunctions.Destruction(sorted);

            Console.WriteLine();
            Console.WriteLine("Destruct Down");
            PrintTrace();

            Console.WriteLine("Finalize");
            var results = SolvingFunctions.FinalizeUp(sorted, _outputNodes.ToArray());

            Console.WriteLine($"Type variables: {results.TypeVariables.Length}");
            foreach (var typeVariable in results.TypeVariables)
            {
                Console.WriteLine("    " + typeVariable);
            }

            Console.WriteLine($"Syntax node types: ");
            foreach (var syntaxNode in results.SyntaxNodes.Where(s => s != null))
            {
                Console.WriteLine("    " + syntaxNode);
            }

            Console.WriteLine($"Named node types: ");
            foreach (var namedNode in results.NamedNodes)
            {
                Console.WriteLine("    " + namedNode);
            }

            return(results);
        }