Exemplo n.º 1
0
        public void Write(TextWriter w)
        {
            var writer = new TextFormatter(w);
            writer.WriteLine("// Equivalence classes ////////////");
            foreach (TypeVariable tv in TypeVariables)
            {
                if (tv.Class.Representative == tv && tv.Class.DataType != null)
                {
                    writer.WriteLine("{0}: {1}", tv.Class, tv.Class.DataType);
                    foreach (TypeVariable tvMember in tv.Class.ClassMembers)
                    {
                        writer.Write("\t{0}", tvMember);
                        WriteExpressionOf(tvMember, writer);
                        writer.WriteLine();
                    }
                }
            }

            writer.WriteLine("// Type Variables ////////////");
            foreach (TypeVariable tv in TypeVariables)
            {
                WriteEntry(tv, writer);
            }
        }
Exemplo n.º 2
0
 public void WriteDecompiledTypes(Program program, TextWriter w)
 {
     WriteHeaderComment(Path.GetFileName(program.TypesFilename), program, w);
     w.WriteLine("/*"); program.TypeStore.Write(w); w.WriteLine("*/");
     var tf = new TextFormatter(w)
     {
         Indentation = 0,
     };
     var fmt = new TypeFormatter(tf);
     foreach (EquivalenceClass eq in program.TypeStore.UsedEquivalenceClasses)
     {
         if (eq.DataType != null)
         {
             tf.WriteKeyword("typedef");     //$REVIEW: C/C++-specific
             tf.Write(" ");
             fmt.Write(eq.DataType, eq.Name);
             w.WriteLine(";");
             w.WriteLine();
         }
     }
 }