Exemplo n.º 1
0
        public List <string> GetLineage(SwiftUncurriedFunctionType uft)
        {
            var lineage = new List <string> ();

            if (uft != null)
            {
                var theClass = uft.UncurriedParameter as SwiftClassType;
                if (theClass == null)
                {
                    var meta = uft.UncurriedParameter as SwiftMetaClassType;
                    if (meta == null)
                    {
                        throw ErrorHelper.CreateError(ReflectorError.kTypeMapBase + 17, $"Expected a SwiftClassType or a SwiftMetaClassType as the uncurried parameter in a function, but got {uft.UncurriedParameter.GetType ().Name}.");
                    }
                    theClass = meta.Class;
                }
                var sb = new StringBuilder().Append(theClass.ClassName.Module.Name);
                foreach (SwiftName name in theClass.ClassName.NestingNames)
                {
                    sb.Append('.').Append(name.Name);
                    lineage.Add(sb.ToString());
                }
            }
            return(lineage);
        }
Exemplo n.º 2
0
        static bool IsMethodOnClass(SwiftType signature, SwiftClassType cl)
        {
            if (cl == null)
            {
                return(false);
            }
            if (signature is SwiftWitnessTableType)
            {
                return(false);
            }
            SwiftUncurriedFunctionType ucf = signature as SwiftUncurriedFunctionType;

            if (ucf == null)
            {
                return(false);
            }
            return(ucf.UncurriedParameter is SwiftClassType && ucf.UncurriedParameter.Equals(cl));
        }