Esempio n. 1
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public ILMethodDefinition(ILTypeDefinition declaringType, MethodDefinition method, string forceScopeId = null)
     : base(declaringType)
 {
     this.method        = method;
     OriginalReturnType = method.ReturnType;
     scopeId            = forceScopeId;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public ILMethodDefinition(ILTypeDefinition declaringType, MethodDefinition method, string forceScopeId=null)
     : base(declaringType)
 {
     this.method = method;
     OriginalReturnType = method.ReturnType;
     scopeId = forceScopeId;
 }
            /// <summary>
            /// Default ctor
            /// </summary>
            public ILTypeDefinition(XModule module, XTypeDefinition declaringType, TypeDefinition type)
                : base(module, declaringType, type.IsValueType, type.GenericParameters.Select(x => x.Name))
            {
                this.type = type;
                fields = new List<XFieldDefinition>(type.Fields.Count);
                methods = new List<XMethodDefinition>(type.Methods.Count);
                nested = new List<XTypeDefinition>();
                interfaces = new List<XTypeReference>();

                // Add nested types
                foreach (var source in type.NestedTypes/*.Where(t=>t.IsReachable) should we only consider reachables?*/)
                {
                    var nestedType = new ILTypeDefinition(Module, this, source);
                    nested.Add(nestedType);
                    module.Register(nestedType);
                }

                 methodToIdx = type.Methods.Select((m, idx) => new { m, idx }).ToDictionary(k => k.m, k => k.idx);
            }
            /// <summary>
            /// Default ctor
            /// </summary>
            public ILTypeDefinition(XModule module, XTypeDefinition declaringType, TypeDefinition type)
                : base(module, declaringType, type.IsValueType, type.GenericParameters.Select(x => x.Name))
            {
                this.type  = type;
                fields     = new List <XFieldDefinition>(type.Fields.Count);
                methods    = new List <XMethodDefinition>(type.Methods.Count);
                nested     = new List <XTypeDefinition>();
                interfaces = new List <XTypeReference>();

                // Add nested types
                foreach (var source in type.NestedTypes /*.Where(t=>t.IsReachable) should we only consider reachables?*/)
                {
                    var nestedType = new ILTypeDefinition(Module, this, source);
                    nested.Add(nestedType);
                    module.Register(nestedType);
                }

                methodToIdx = type.Methods.Select((m, idx) => new { m, idx }).ToDictionary(k => k.m, k => k.idx);
            }