// It would be nice to make this a virtual method on typeSym.
public AggregateType GetAggTypeSym(CType typeSym)
{
Debug.Assert(typeSym != null);
Debug.Assert(typeSym.IsAggregateType() ||
typeSym.IsTypeParameterType() ||
typeSym.IsArrayType() ||
typeSym.IsNullableType());
switch (typeSym.GetTypeKind())
{
case TypeKind.TK_AggregateType:
return(typeSym.AsAggregateType());
case TypeKind.TK_ArrayType:
return(GetReqPredefType(PredefinedType.PT_ARRAY));
case TypeKind.TK_TypeParameterType:
return(typeSym.AsTypeParameterType().GetEffectiveBaseClass());
case TypeKind.TK_NullableType:
return(typeSym.AsNullableType().GetAts(ErrorContext));
}
Debug.Assert(false, "Bad typeSym!");
return(null);
}