private CType ProcessSpecialTypeInChain(NamespaceOrAggregateSymbol parent, Type t)
{
CType ctype;
if (t.IsGenericParameter)
{
AggregateSymbol agg = parent as AggregateSymbol;
Debug.Assert(agg != null);
ctype = LoadClassTypeParameter(agg, t);
return ctype;
}
else if (t.IsArray)
{
// Now we return an array of nesting level corresponding to the rank.
ctype = _typeManager.GetArray(GetCTypeFromType(t.GetElementType()), t.GetArrayRank());
return ctype;
}
else if (t.IsPointer)
{
// Now we return the pointer type that we want.
ctype = _typeManager.GetPointer(GetCTypeFromType(t.GetElementType()));
return ctype;
}
else if (t.IsNullableType())
{
// Get a nullable type of the underlying type.
if (t.GetGenericArguments()[0].DeclaringType == t)
{
// If the generic argument for nullable is our child, then we're
// declaring the initial Nullable<T>.
AggregateSymbol agg = _symbolTable.LookupSym(
GetName(t), parent, symbmask_t.MASK_AggregateSymbol).AsAggregateSymbol();
if (agg != null)
{
agg = FindSymWithMatchingArity(agg, t);
if (agg != null)
{
Debug.Assert(agg.getThisType().AssociatedSystemType == t);
return agg.getThisType();
}
}
return AddAggregateToSymbolTable(parent, t).getThisType();
}
ctype = _typeManager.GetNullable(GetCTypeFromType(t.GetGenericArguments()[0]));
return ctype;
}
return null;
}