Esempio n. 1
0
 /// <summary>
 /// Convert .NET type to Fantom type.
 /// </summary>
 public static Fan.Sys.Type toFanType(Type dotnetType, bool check)
 {
     Fan.Sys.Type t = (Fan.Sys.Type)dotnetToFanTypes[dotnetType.FullName];
     if (t != null)
     {
         return(t);
     }
     if (!check)
     {
         return(null);
     }
     throw Fan.Sys.Err.make("Not a Fantom type: " + dotnetType).val;
 }
Esempio n. 2
0
 /// <summary>
 /// Return if the Fantom Type is represented as a .NET class
 /// such as sys::Int as Fan.Sys.Long.
 /// </summary>
 public static bool isDotnetRepresentation(Fan.Sys.Type t)
 {
     if (t.pod() != Fan.Sys.Sys.m_sysPod)
     {
         return(false);
     }
     return(t == Fan.Sys.Sys.ObjType ||
            t == Fan.Sys.Sys.BoolType ||
            t == Fan.Sys.Sys.StrType ||
            t == Fan.Sys.Sys.IntType ||
            t == Fan.Sys.Sys.FloatType ||
            t == Fan.Sys.Sys.NumType ||
            t == Fan.Sys.Sys.DecimalType);
 }
Esempio n. 3
0
 /// <summary>
 /// Given a Fantom type, get its stack type: 'A', 'I', 'J', etc
 /// </summary>
 public static int toDotnetStackType(Fan.Sys.Type t)
 {
     if (!t.isNullable())
     {
         if (t == Fan.Sys.Sys.VoidType)
         {
             return('V');
         }
         if (t == Fan.Sys.Sys.BoolType)
         {
             return('I');
         }
         if (t == Fan.Sys.Sys.IntType)
         {
             return('J');
         }
         if (t == Fan.Sys.Sys.FloatType)
         {
             return('D');
         }
     }
     return('A');
 }
Esempio n. 4
0
 /// <summary>
 /// Return the .NET type name for this Fantom type.
 /// </summary>
 public static string toDotnetTypeName(Fan.Sys.Type type)
 {
     return(toDotnetTypeName(type.pod().name(), type.name(), type.isNullable()));
 }