Example #1
0
 public static void Serialize(this IEnumerable <AstDocument> list, SourcePackage upk, string filename, AstSerializationFlags flags)
 {
     using (var w = AstWriter.Create(upk, filename, flags))
         foreach (var e in list)
         {
             w.WriteDocument(e);
         }
 }
Example #2
0
        public static AstWriter Create(SourcePackage upk, string filename, AstSerializationFlags flags)
        {
            if (upk.IsUnknown)
            {
                throw new InvalidOperationException("AstWriter: Unknown source package");
            }

            var w = new AstWriter(upk, filename, flags);

            w.Write(AstSerialization.Magic);
            return(w);
        }
Example #3
0
 public static void Serialize(this AstBlock block, string filename, AstSerializationFlags flags = 0)
 {
     using (var w = AstWriter.Create(block.Name.Source.Package, filename, flags))
         w.WriteBlock(block);
 }