示例#1
0
 /// <summary>
 /// Two array types are compatible if:
 /// 1. Their element types are compatible.
 /// 2. If both have constant size, that size is the same.
 ///
 /// Note:
 /// arrays of unknown bound is compatible with any array of compatible element type.
 /// arrays of variable length is compatible with any array of compatible element type.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Compatible(TUnqualified other)
 {
     if (other.IsArray)
     {
         TArr a = other as TArr;
         if (element.Compatible(a.element))
         {
             // They points to compatible type.
             // Check if other is VLA.
             if (a is TVArr)
             {
                 return(true);
             }
             if (IsComplete && a.IsComplete)
             {
                 return(n == (a as TCArr).n);
             }
             else
             {
                 return(true);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 /// <summary>
 /// Arrays with variable length is compatible with any array of compatible element type.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Compatible(TUnqualified other)
 {
     if (other.IsArray)
     {
         TArr a = other as TArr;
         return(element.Compatible(a.element));
     }
     else
     {
         return(false);
     }
 }
示例#3
0
 /// <summary>
 /// Two array types are compatible if:
 /// 1. Their element types are compatible.
 /// 2. If both have constant size, that size is the same.
 ///
 /// Note:
 /// arrays of unknown bound is compatible with any array of compatible element type.
 /// arrays of variable length is compatible with any array of compatible element type.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Compatible(TUnqualified other)
 {
     if (other.IsArray)
     {
         TArr a = other as TArr;
         if (element.Compatible(a.element))
         {
             // They points to compatible type.
             // Check if other is VLA.
             return(true);
         }
     }
     return(false);
 }