public static InflatedCollectionCollector Collect(TypeDefinition type)
 {
     InflatedCollectionCollector generics = new InflatedCollectionCollector();
     GenericContextFreeVisitor visitor = new GenericContextFreeVisitor(generics);
     Unity.Cecil.Visitor.Extensions.Accept(type, visitor);
     return generics;
 }
 private static void AddArrayIfNeeded(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod, TypeDefinition ienumerableDefinition, TypeDefinition icollectionDefinition, TypeDefinition ilistDefinition)
 {
     TypeDefinition definition = type.Resolve();
     if (((definition == ienumerableDefinition) || (definition == icollectionDefinition)) || (definition == ilistDefinition))
     {
         ProcessArray(new ArrayType(type.GenericArguments[0]), generics, new GenericContext(type, contextMethod));
     }
 }
        public static InflatedCollectionCollector Collect(TypeDefinition type)
        {
            InflatedCollectionCollector generics = new InflatedCollectionCollector();
            GenericContextFreeVisitor   visitor  = new GenericContextFreeVisitor(generics);

            type.Accept(visitor);
            return(generics);
        }
 public ReadOnlyInflatedCollectionCollector(InflatedCollectionCollector inflatedCollectionCollector)
 {
     this.Types = inflatedCollectionCollector.Types.Items;
     this.TypeDeclarations = inflatedCollectionCollector.TypeDeclarations.Items;
     this.TypeMethodDeclarations = inflatedCollectionCollector.TypeDeclarations.Items;
     this.Methods = inflatedCollectionCollector.Methods.Items;
     this.Arrays = inflatedCollectionCollector.Arrays.Items;
     this.EmptyTypes = inflatedCollectionCollector.EmptyTypes.Items;
 }
 public ReadOnlyInflatedCollectionCollector(InflatedCollectionCollector inflatedCollectionCollector)
 {
     this.Types                  = inflatedCollectionCollector.Types.Items;
     this.TypeDeclarations       = inflatedCollectionCollector.TypeDeclarations.Items;
     this.TypeMethodDeclarations = inflatedCollectionCollector.TypeDeclarations.Items;
     this.Methods                = inflatedCollectionCollector.Methods.Items;
     this.Arrays                 = inflatedCollectionCollector.Arrays.Items;
     this.EmptyTypes             = inflatedCollectionCollector.EmptyTypes.Items;
 }
 internal static void ProcessGenericType(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod, CollectionMode mode)
 {
     bool flag = generics.TypeDeclarations.Add(type);
     if (((mode != CollectionMode.Types) || flag) && ((mode != CollectionMode.MethodsAndTypes) || generics.TypeMethodDeclarations.Add(type)))
     {
         GenericContext genericContext = new GenericContext(type, contextMethod);
         Unity.Cecil.Visitor.Extensions.Accept(type.ElementType.Resolve(), new GenericContextAwareDeclarationOnlyVisitor(generics, genericContext, CollectionMode.Types));
         foreach (GenericInstanceType type2 in Enumerable.OfType<GenericInstanceType>(type.GenericArguments))
         {
             ProcessGenericType(Inflater.InflateType(genericContext, type2), generics, null, mode);
         }
     }
 }
Example #7
0
        internal static void ProcessGenericType(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod, CollectionMode mode)
        {
            bool flag = generics.TypeDeclarations.Add(type);

            if (((mode != CollectionMode.Types) || flag) && ((mode != CollectionMode.MethodsAndTypes) || generics.TypeMethodDeclarations.Add(type)))
            {
                GenericContext genericContext = new GenericContext(type, contextMethod);
                type.ElementType.Resolve().Accept(new GenericContextAwareDeclarationOnlyVisitor(generics, genericContext, CollectionMode.Types));
                foreach (GenericInstanceType type2 in type.GenericArguments.OfType <GenericInstanceType>())
                {
                    ProcessGenericType(Inflater.InflateType(genericContext, type2), generics, null, mode);
                }
            }
        }
Example #8
0
 public GenericContextAwareDeclarationOnlyVisitor(InflatedCollectionCollector generics, GenericContext genericContext, CollectionMode mode = 0)
 {
     this._generics       = generics;
     this._genericContext = genericContext;
     this._mode           = mode;
 }
 private static void AddGenericComparerIfNeeded(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod, TypeDefinition comparerDefinition, TypeDefinition genericElementComparisonInterfaceDefinition, TypeDefinition genericComparerDefinition)
 {
 public GenericContextAwareVisitor(InflatedCollectionCollector generics, GenericContext genericContext)
 {
     this._generics = generics;
     this._genericContext = genericContext;
 }
 public TableInfo Write(InflatedCollectionCollector generics, MethodTables methodTables, IMethodCollectorResults methodCollector)
 {
     IncludeWriter.WriteRegistrationIncludes(this._writer);
     WriteIncludesFor(this._writer, generics);
     if (<>f__am$cache0 == null)
     {
 public GenericContextFreeVisitor(InflatedCollectionCollector generics)
 {
     this._generics = generics;
 }
 internal static void ProcessArray(ArrayType inflatedType, InflatedCollectionCollector generics, GenericContext currentContext)
 {
     generics.Arrays.Add(inflatedType);
 }
 public GenericContextAwareDeclarationOnlyVisitor(InflatedCollectionCollector generics, GenericContext genericContext, [Optional, DefaultParameterValue(0)] CollectionMode mode)
 {
     this._generics = generics;
     this._genericContext = genericContext;
     this._mode = mode;
 }
 public GenericContextFreeVisitor(InflatedCollectionCollector generics)
 {
     this._generics = generics;
 }
Example #16
0
 internal static void ProcessArray(ArrayType inflatedType, InflatedCollectionCollector generics, GenericContext currentContext)
 {
     generics.Arrays.Add(inflatedType);
 }
Example #17
0
 public void Collect(InflatedCollectionCollector generics, IEnumerable <TypeDefinition> types, VTableBuilder vTableBuilder)
 {
     if (< > f__am$cache0 == null)
     {
 public void Collect(InflatedCollectionCollector generics, IEnumerable<TypeDefinition> types, VTableBuilder vTableBuilder)
 {
     if (<>f__am$cache0 == null)
     {