TargetFundamentalType GetFundamentalType(Type type)
{
switch (Type.GetTypeCode (type)) {
case TypeCode.Boolean:
return builtin_types.BooleanType;
case TypeCode.Char:
return builtin_types.CharType;
case TypeCode.SByte:
return builtin_types.SByteType;
case TypeCode.Byte:
return builtin_types.ByteType;
case TypeCode.Int16:
return builtin_types.Int16Type;
case TypeCode.UInt16:
return builtin_types.UInt16Type;
case TypeCode.Int32:
return builtin_types.Int32Type;
case TypeCode.UInt32:
return builtin_types.UInt32Type;
case TypeCode.Int64:
return builtin_types.Int64Type;
case TypeCode.UInt64:
return builtin_types.UInt64Type;
case TypeCode.Single:
return builtin_types.SingleType;
case TypeCode.Double:
return builtin_types.DoubleType;
case TypeCode.String:
return builtin_types.StringType;
case TypeCode.Object:
if (type == typeof (IntPtr))
return builtin_types.IntType;
else if (type == typeof (UIntPtr))
return builtin_types.UIntType;
return null;
case TypeCode.Decimal:
return builtin_types.DecimalType;
default:
return null;
}
}