コード例 #1
0
 public static InflatedCollectionCollector Collect(TypeDefinition type)
 {
     InflatedCollectionCollector generics = new InflatedCollectionCollector();
     GenericContextFreeVisitor visitor = new GenericContextFreeVisitor(generics);
     Unity.Cecil.Visitor.Extensions.Accept(type, visitor);
     return generics;
 }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
        public static InflatedCollectionCollector Collect(TypeDefinition type)
        {
            InflatedCollectionCollector generics = new InflatedCollectionCollector();
            GenericContextFreeVisitor   visitor  = new GenericContextFreeVisitor(generics);

            type.Accept(visitor);
            return(generics);
        }
コード例 #4
0
 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;
 }
コード例 #5
0
 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);
         }
     }
 }
コード例 #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);
                }
            }
        }
コード例 #8
0
 public GenericContextAwareDeclarationOnlyVisitor(InflatedCollectionCollector generics, GenericContext genericContext, CollectionMode mode = 0)
 {
     this._generics       = generics;
     this._genericContext = genericContext;
     this._mode           = mode;
 }
コード例 #9
0
 private static void AddGenericComparerIfNeeded(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod, TypeDefinition comparerDefinition, TypeDefinition genericElementComparisonInterfaceDefinition, TypeDefinition genericComparerDefinition)
 {
コード例 #10
0
 public GenericContextAwareVisitor(InflatedCollectionCollector generics, GenericContext genericContext)
 {
     this._generics = generics;
     this._genericContext = genericContext;
 }
コード例 #11
0
 public TableInfo Write(InflatedCollectionCollector generics, MethodTables methodTables, IMethodCollectorResults methodCollector)
 {
     IncludeWriter.WriteRegistrationIncludes(this._writer);
     WriteIncludesFor(this._writer, generics);
     if (<>f__am$cache0 == null)
     {
コード例 #12
0
 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;
 }
コード例 #15
0
 public GenericContextFreeVisitor(InflatedCollectionCollector generics)
 {
     this._generics = generics;
 }
コード例 #16
0
 internal static void ProcessArray(ArrayType inflatedType, InflatedCollectionCollector generics, GenericContext currentContext)
 {
     generics.Arrays.Add(inflatedType);
 }
コード例 #17
0
 public void Collect(InflatedCollectionCollector generics, IEnumerable <TypeDefinition> types, VTableBuilder vTableBuilder)
 {
     if (< > f__am$cache0 == null)
     {
コード例 #18
0
 public void Collect(InflatedCollectionCollector generics, IEnumerable<TypeDefinition> types, VTableBuilder vTableBuilder)
 {
     if (<>f__am$cache0 == null)
     {