static bool TypeMatches(FunctionDeclaration decl, NamedTypeSpec ts, SwiftClassType ct, TypeMapper typeMap)
 {
     if (ct == null)
     {
         return(false);
     }
     return(ts.Name == ct.ClassName.ToFullyQualifiedName(true) ||
            ts.NameWithoutModule == ct.ClassName.ToFullyQualifiedName(false));
 }
Exemplo n.º 2
0
 public SwiftProtocolListType(SwiftClassType protocol, bool isReference, SwiftName name = null)
     : base(CoreCompoundType.ProtocolList, isReference, name)
 {
     Protocols = new List <SwiftClassType> ();
     if (!protocol.IsProtocol)
     {
         throw new ArgumentOutOfRangeException($"Type {protocol.ClassName.ToFullyQualifiedName ()} is not a protocol");
     }
     Protocols.Add(protocol);
 }
Exemplo n.º 3
0
 public SwiftWitnessTableType(WitnessType witnessType, SwiftClassType protocolType = null, SwiftClassType owningType = null)
     : base((SwiftType)owningType ?? SwiftTupleType.Empty, SwiftTupleType.Empty, SwiftTupleType.Empty, false, false, null)
 {
     WitnessType = witnessType;
     if (WitnessType == WitnessType.Protocol && protocolType == null)
     {
         throw new ArgumentNullException(nameof(protocolType));
     }
     ProtocolType = protocolType;
 }
        public void DecomposeUnsafePointer()
        {
            // NB: this function used UnsafePointer<()> which is deprecated.
            var func = "_$s17unitHelpFrawework19setMonty_xam_vtable_3uvtyAA0f5_sub_E0V_SPyytGtF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            SwiftType bft = tlf.Signature.GetParameter(1);

            Assert.IsNotNull(bft, "bft");
            Assert.IsTrue(bft is SwiftBoundGenericType, "is SwiftBoundGeneric");
            var            gen      = bft as SwiftBoundGenericType;
            SwiftClassType baseType = gen.BaseType as SwiftClassType;

            Assert.NotNull(baseType, "baseType");
            Assert.AreEqual("UnsafePointer", baseType.ClassName.Terminus.Name, "UnsafePointer");
        }
Exemplo n.º 5
0
 public SwiftMetaClassType(SwiftClassType classType, bool isReference, SwiftName name = null)
     : base(CoreCompoundType.MetaClass, isReference, name)
 {
     Class = Ex.ThrowOnNull(classType, nameof(classType));
 }
Exemplo n.º 6
0
 public SwiftDestructorType(bool isDeallocating, SwiftClassType classType, bool isReference, bool canThrow)
     : base(classType, classType, isReference, canThrow,
            isDeallocating ? Decomposer.kSwiftDeallocatingDestructorName : Decomposer.kSwiftNonDeallocatingDestructorName, null)
 {
     memberType = isDeallocating ? MemberType.Deallocator : MemberType.Destructor;
 }
Exemplo n.º 7
0
 public SwiftStaticFunctionType(SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftClassType ofClass, SwiftName name = null, SwiftType extensionOn = null)
     : base(parms, ret, isReference, canThrow, name, extensionOn)
 {
     OfClass = ofClass;
 }
Exemplo n.º 8
0
 public SwiftInitializerType(InitializerType initType, SwiftType ret, SwiftClassType owner, SwiftName name)
     : base(SwiftTupleType.Empty, ret, false, false, name, null)
 {
     Owner           = Ex.ThrowOnNull(owner, nameof(owner));
     InitializerType = initType;
 }