示例#1
0
        public static void ToSource(MjoScript script)
        {
            if (script.Representation == MjoScriptRepresentation.SyntaxTree)
            {
                script.SanityCheck();
                return;
            }

            if (script.Representation != MjoScriptRepresentation.SsaGraph)
            {
                throw new Exception("Unable to convert script to source representation from current state: " + script.Representation);
            }

            script.Representation = MjoScriptRepresentation.InTransition;


            foreach (var function in script.Functions)
            {
                var node = new Decompiler(function).Decompile();
                node.Accept(new DumpVisitor(), IColoredWriter.Console);
                Console.WriteLine();
            }

            script.Representation = MjoScriptRepresentation.SyntaxTree;
            script.SanityCheck();
        }