private string GetTypeName(TypeNode type)
{
string typeName;
if (type.Name != null)
typeName = type.Name.Name;
else if (type is TypeExpression)
{
Expression expr = ((TypeExpression)type).Expression;
if (expr is Identifier)
typeName = ((Identifier)expr).Name;
else if (expr is QualifiedIdentifier)
typeName = ((QualifiedIdentifier)expr).Identifier.Name;
else
throw new ApplicationException("unexpected type node");
}
else
throw new ApplicationException("unexpected type node");
return typeName;
}