Example #1
0
 private static void SortTypes(TypeMeta aItem)
 {
     aItem.Fields = (from item in aItem.Fields
                     orderby(string) item.Data[DataIds.DebugMetaId]
                     select item).ToList();
     aItem.Methods = (from item in aItem.Methods
                      orderby(string) item.Data[DataIds.DebugMetaId]
                      select item).ToList();
     foreach (var xMethod in aItem.Methods)
     {
         SortMethod(xMethod);
     }
 }
Example #2
0
 private static void SortTypes(TypeMeta aItem)
 {
     aItem.Fields = (from item in aItem.Fields
                     orderby (string)item.Data[DataIds.DebugMetaId]
                     select item).ToList();
     aItem.Methods = (from item in aItem.Methods
                      orderby (string)item.Data[DataIds.DebugMetaId]
                      select item).ToList();
     foreach (var xMethod in aItem.Methods)
     {
         SortMethod(xMethod);
     }
     
 }
Example #3
0
        /// <summary>
        /// Sorts the given <paramref name="aTypes"/>. Does this using the Debug DataId. Will throw an exception when not in debug mode
        /// </summary>
        /// <param name="aTypes"></param>
        /// <returns></returns>
        public static TypeMeta[] SortTypes(TypeMeta[] aTypes)
        {
#if !DEBUG
            throw new NotSupportedException("Cannot sort in release builds!");
#else

            var xTempResult = (from item in aTypes
                               orderby (string)item.Data[DataIds.DebugMetaId]
                               select item).ToArray();
            foreach (var xItem in xTempResult)
            {
                SortTypes(xItem);
            }
            return xTempResult;
#endif
        }
Example #4
0
File: Dump.cs Project: Orvid/Cosmos
        private static void DumpTypeMeta(TypeMeta item, XmlWriter output)
        {
            output.WriteStartElement("TypeMeta");
            {
#if DEBUG
                output.WriteAttributeString("MetaId", (string)item.Data[EcmaCil.DataIds.DebugMetaId]);
#endif
                //output.WriteAttributeString("FullName", type.FullName);
                //output.WriteAttributeString("BaseType", (type.BaseType != null ? "#" + type.BaseType.MetaId : ""));
#if DEBUG
                if (item.BaseType != null)
                {
                    output.WriteAttributeString("BaseType", (string)item.BaseType.Data[EcmaCil.DataIds.DebugMetaId]);
                }
                if (item.Descendants.Count > 0)
                {
                    output.WriteStartElement("Descendants");
                    {
                        foreach (var xDescendant in item.Descendants)
                        {
                            output.WriteStartElement("Descendant");
                            {
                                output.WriteAttributeString("Type", (string)xDescendant.Data[EcmaCil.DataIds.DebugMetaId]); 
                            }
                            output.WriteEndElement(); // Descendant
                        }
                    }
                    output.WriteEndElement(); // descendants
                }

#else
                if (item.BaseType != null)
                {
                    output.WriteAttributeString("HasBaseType", "true");
                }
#endif
                output.WriteStartElement("Methods");
                {
                    foreach (var xMethod in item.Methods)
                    {
                        DumpMethod(xMethod, output);
                    }
                }
                output.WriteEndElement();
            }
            output.WriteEndElement();
        }
Example #5
0
File: Dump.cs Project: zer09/Cosmos
        private static void DumpTypeMeta(TypeMeta item, XmlWriter output)
        {
            output.WriteStartElement("TypeMeta");
            {
#if DEBUG
                output.WriteAttributeString("MetaId", (string)item.Data[EcmaCil.DataIds.DebugMetaId]);
#endif
                //output.WriteAttributeString("FullName", type.FullName);
                //output.WriteAttributeString("BaseType", (type.BaseType != null ? "#" + type.BaseType.MetaId : ""));
#if DEBUG
                if (item.BaseType != null)
                {
                    output.WriteAttributeString("BaseType", (string)item.BaseType.Data[EcmaCil.DataIds.DebugMetaId]);
                }
                if (item.Descendants.Count > 0)
                {
                    output.WriteStartElement("Descendants");
                    {
                        foreach (var xDescendant in item.Descendants)
                        {
                            output.WriteStartElement("Descendant");
                            {
                                output.WriteAttributeString("Type", (string)xDescendant.Data[EcmaCil.DataIds.DebugMetaId]);
                            }
                            output.WriteEndElement(); // Descendant
                        }
                    }
                    output.WriteEndElement(); // descendants
                }
#else
                if (item.BaseType != null)
                {
                    output.WriteAttributeString("HasBaseType", "true");
                }
#endif
                output.WriteStartElement("Methods");
                {
                    foreach (var xMethod in item.Methods)
                    {
                        DumpMethod(xMethod, output);
                    }
                }
                output.WriteEndElement();
            }
            output.WriteEndElement();
        }
Example #6
0
File: Dump.cs Project: Orvid/Cosmos
 private static void DumpType(TypeMeta item, XmlWriter output)
 {
     var xArrayType = item as ArrayTypeMeta;
     if (xArrayType != null)
     {
         DumpArrayType(xArrayType, output);
         return;
     }
     var xPointerType = item as PointerTypeMeta;
     if (xPointerType != null)
     {
         DumpPointerType(xPointerType, output);
         return;
     }
     if (item.GetType() == typeof(TypeMeta))
     {
         DumpTypeMeta(item, output);
         return;
     }
     throw new NotImplementedException("Type '" + item.GetType().FullName + "' not implemented");
 }
Example #7
0
File: Dump.cs Project: zer09/Cosmos
        private static void DumpType(TypeMeta item, XmlWriter output)
        {
            var xArrayType = item as ArrayTypeMeta;

            if (xArrayType != null)
            {
                DumpArrayType(xArrayType, output);
                return;
            }
            var xPointerType = item as PointerTypeMeta;

            if (xPointerType != null)
            {
                DumpPointerType(xPointerType, output);
                return;
            }
            if (item.GetType() == typeof(TypeMeta))
            {
                DumpTypeMeta(item, output);
                return;
            }
            throw new NotImplementedException("Type '" + item.GetType().FullName + "' not implemented");
        }