Beispiel #1
0
 private void ImportType(TypeDef td)
 {
     if (this.IsTypeDefined(td.Name))
     {
         return;
     };
     if (td is StructDef)
     {
         ImportStruct((StructDef)td);
     }
     else
     {
         AddType(td.CloneTypeDef());
     }
 }
Beispiel #2
0
 public void AddType(TypeDef sd)
 {
     List<TypeDef> l = new List<TypeDef>();
     l.Add(sd);
     AddTypes(l);
 }
Beispiel #3
0
 private void ValidateTypeDef(TypeDef td, ValidationCtx ctx)
 {
     if (IsTypeDefined(td.Name)) return;
     if (ctx.ValidatedTypes.ContainsKey(td.Name)) return;
     ctx.ValidatedTypes.Add(td.Name, td);
     if (td is SimpleTypeDef)
     {
         return;
     }
     else if (td is StructDef)
     {
         StructDef sd = (StructDef)td;
         foreach (MemberDef md in sd.Members)
         {
             if (!IsTypeDefined(md.TypeName))
             {
                 if (!ctx.NewTypes.ContainsKey(md.TypeName))
                 {
                     throw new ApplicationException(string.Format("Member type ({0}) not defined for {1}.{2}", md.TypeName, sd.Name, md.Name));
                 }
                 TypeDef td2 = ctx.NewTypes[md.TypeName];
                 ValidateTypeDef(td2, ctx);
             }
         }
     }
     else if (td is EnumDef)
     {
         EnumDef ed = (EnumDef)td;
     }
     else throw new Exception();
 }