Exemplo n.º 1
0
        public static DefaultResolvedMethod CreateFromMultipleParts(IUnresolvedMethod[] parts, ITypeResolveContext[] contexts, bool isExtensionMethod)
        {
            DefaultResolvedMethod method = new DefaultResolvedMethod(parts[0], contexts[0], isExtensionMethod);

            method.parts = parts;
            if (parts.Length > 1)
            {
                var attrs = new ListOfLists <IAttribute>();
                attrs.AddList(method.Attributes);
                for (int i = 1; i < parts.Length; i++)
                {
                    attrs.AddList(parts[i].Attributes.CreateResolvedAttributes(contexts[i]));
                }
                method.Attributes = attrs;
            }
            return(method);
        }
Exemplo n.º 2
0
 public IEnumerable <IMethod> GetConstructors(Predicate <IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)
 {
     if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
     {
         if (this.HasDefaultConstructorConstraint || this.HasValueTypeConstraint)
         {
             if (filter == null || filter(DefaultUnresolvedMethod.DummyConstructor))
             {
                 return(new [] { DefaultResolvedMethod.GetDummyConstructor(compilation, this) });
             }
         }
         return(EmptyList <IMethod> .Instance);
     }
     else
     {
         return(GetMembersHelper.GetConstructors(this, filter, options));
     }
 }
Exemplo n.º 3
0
 public MemberList(List <ITypeResolveContext> contextPerMember, List <IUnresolvedMember> unresolvedNonPartialMembers, List <PartialMethodInfo> partialMethodInfos)
 {
     this.NonPartialMemberCount = unresolvedNonPartialMembers.Count;
     this.contextPerMember      = contextPerMember.ToArray();
     this.unresolvedMembers     = unresolvedNonPartialMembers.ToArray();
     if (partialMethodInfos == null)
     {
         this.resolvedMembers = new IMember[unresolvedNonPartialMembers.Count];
     }
     else
     {
         this.resolvedMembers = new IMember[unresolvedNonPartialMembers.Count + partialMethodInfos.Count];
         for (int i = 0; i < partialMethodInfos.Count; i++)
         {
             var info        = partialMethodInfos[i];
             int memberIndex = NonPartialMemberCount + i;
             resolvedMembers[memberIndex] = DefaultResolvedMethod.CreateFromMultipleParts(
                 info.Parts.ToArray(), info.Contexts.ToArray(), false);
         }
     }
 }