private void ValidateTypeDeclaration(CodeTypeDeclaration e) {
// This function can be called recursively and will modify the global variable currentClass
// We will save currentClass to a local, modify it to do whatever we want and restore it back when we exit so that it is re-entrant.
CodeTypeDeclaration savedClass = currentClass;
currentClass = e;
ValidateTypeStart(e);
ValidateTypeParameters(e.TypeParameters);
ValidateTypeMembers(e); // Recursive call can come from here.
ValidateTypeReferences(e.BaseTypes);
currentClass = savedClass;
}