static void BuiltInTypeIsA(SwiftType t, CoreBuiltInType ct)
        {
            SwiftBuiltInType bit = t as SwiftBuiltInType;

            if (bit == null)
            {
                Assert.Fail("Not a SwiftBuiltInType: " + t.GetType().Name);
            }
            Assert.AreEqual(ct, bit.BuiltInType, "same built in type");
        }
        void TestFuncReturningFoo(string funcMangle, CoreBuiltInType cbt)
        {
            var func = Decomposer.Decompose(funcMangle, true) as TLFunction;

            Assert.IsNotNull(func, "func");
            Assert.AreEqual("foo", func.Module.Name, "module");
            Assert.IsNotNull(func.Signature, "signature");
            Assert.IsFalse(func.Signature.IsVoid, "IsVoid");
            var ret = func.Signature.ReturnType;

            var st = ret as SwiftBuiltInType;

            Assert.IsNotNull(st, "st");
            Assert.AreEqual(cbt, st.BuiltInType, "matches type");
        }
        void TestFunc3XXXReturningVoid(string funcmangle, CoreBuiltInType csv)
        {
            var func = Decomposer.Decompose(funcmangle, true) as TLFunction;

            Assert.IsNotNull(func, "func");
            Assert.AreEqual("foo", func.Module.Name, "module");
            Assert.IsNotNull(func.Signature, "signature");
            Assert.IsTrue(func.Signature.IsVoid, "IsVoid");
            var parms = func.Signature.Parameters;

            Assert.IsNotNull(parms, "parms");
            var tt = parms as SwiftTupleType;

            Assert.IsNotNull(tt, "tt");
            Assert.AreEqual(3, tt.Contents.Count, "tuple size");
            foreach (SwiftType st in tt.Contents)
            {
                SwiftBuiltInType scalar = st as SwiftBuiltInType;
                Assert.IsNotNull(scalar, "scalar");
                Assert.AreEqual(csv, scalar.BuiltInType, "scalar type");
            }
        }
Ejemplo n.º 4
0
 public SwiftBuiltInType(CoreBuiltInType scalarType, bool isReference, SwiftName name = null)
     : base(CoreCompoundType.Scalar, isReference, name)
 {
     BuiltInType = scalarType;
 }