static bool TypeMatches(FunctionDeclaration decl, NamedTypeSpec ts, SwiftProtocolListType protList, TypeMapper typeMap)
        {
            if (protList == null)
            {
                return(false);
            }
            if (protList.Protocols.Count == 1 && !ts.IsProtocolList)
            {
                return(TypeMatches(decl, ts, protList.Protocols [0], typeMap));
            }

            if (protList.Protocols.Count != ts.GenericParameters.Count || !ts.IsProtocolList)
            {
                return(false);
            }
            for (int i = 0; i < ts.GenericParameters.Count; i++)
            {
                if (!TypeMatches(decl, ts.GenericParameters [i], protList.Protocols [i], typeMap))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
 public SwiftExistentialMetaType(SwiftProtocolListType protocolList, bool isReference, SwiftName name = null)
     : base(CoreCompoundType.MetaClass, isReference, name)
 {
     Protocol = Ex.ThrowOnNull(protocolList, nameof(protocolList));
 }