Exemple #1
0
 public override bool TryMonomorphize(AstType ExpectedType, ref Dictionary <string, Ty> TypeArgs, string[] ExpectedTypeArgs)
 {
     if (!ExpectedType.Is <ListType>())
     {
         return(false);
     }
     return(ListElementsType.TryMonomorphize(ExpectedType.As <ListType>().ListElementsType, ref TypeArgs, ExpectedTypeArgs));
 }
Exemple #2
0
        public override bool TryMonomorphize(AstType ExpectedType, ref Dictionary <string, Ty> TypeArgs, string[] ExpectedTypeArgs)
        {
            if (!ExpectedType.Is <AndType>())
            {
                return(false);
            }
            var atype = ExpectedType.As <AndType>();

            if (atype.Members.Length != Members.Length)
            {
                return(false);
            }
            for (int i = 0; i < Members.Length; ++i)
            {
                if (!Members[i].TryMonomorphize(atype.Members[i], ref TypeArgs, ExpectedTypeArgs))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #3
0
        public override bool TryMonomorphize(AstType ExpectedType, ref Dictionary <string, Ty> TypeArgs, string[] ExpectedTypeArgs)
        {
            if (!ExpectedType.Is <FunctionType>())
            {
                return(false);
            }
            var ftype = ExpectedType.As <FunctionType>();

            if (ftype.InnerTypes.Length != InnerTypes.Length)
            {
                return(false);
            }
            for (int i = 0; i < InnerTypes.Length; ++i)
            {
                if (!InnerTypes[i].TryMonomorphize(ftype.InnerTypes[i], ref TypeArgs, ExpectedTypeArgs))
                {
                    return(false);
                }
            }
            return(true);
        }