Esempio n. 1
0
 public IEnumerable <IMethod> GetConstructors(Predicate <IMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)
 {
     if (Kind == TypeKind.Void)
     {
         return(EmptyList <IMethod> .Instance);
     }
     if (ComHelper.IsComImport(this))
     {
         IType coClass = ComHelper.GetCoClass(this);
         using (var busyLock = BusyManager.Enter(this)) {
             if (busyLock.Success)
             {
                 return(coClass.GetConstructors(filter, options)
                        .Select(m => new SpecializedMethod(m, m.Substitution)
                 {
                     DeclaringType = this
                 }));
             }
         }
         return(EmptyList <IMethod> .Instance);
     }
     if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
     {
         return(GetFiltered(this.Methods, ExtensionMethods.And(m => m.IsConstructor && !m.IsStatic, filter)));
     }
     else
     {
         return(GetMembersHelper.GetConstructors(this, filter, options));
     }
 }
Esempio n. 2
0
 public IEnumerable <IMethod> GetConstructors(Predicate <IMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)
 {
     if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
     {
         if (this.HasDefaultConstructorConstraint || this.HasValueTypeConstraint)
         {
             var dummyCtor = FakeMethod.CreateDummyConstructor(compilation, this);
             if (filter == null || filter(dummyCtor))
             {
                 return(new [] { dummyCtor });
             }
         }
         return(EmptyList <IMethod> .Instance);
     }
     else
     {
         return(GetMembersHelper.GetConstructors(this, filter, options));
     }
 }