public override void VisitProtect(ProtectStatement protect)
{
protect.StatementList.Accept(this);
foreach (ProtectWhen when in protect.WhenPartList) {
when.TypeSpecifier.Accept(this);
TypeData prevExceptionType = currentExceptionType;
currentExceptionType = when.TypeSpecifier.NodeType;
when.ThenPart.Accept(this);
currentExceptionType = prevExceptionType;
}
if (protect.ElsePart != null) {
TypeData prevExceptionType = currentExceptionType;
currentExceptionType =
typeManager.GetTypeData(typeof(Exception));
protect.ElsePart.Accept(this);
currentExceptionType = prevExceptionType;
}
if (protect.WhenPartList.Length == 0 &&
protect.ElsePart == null) {
report.Error(protect.Location,
"`protect' statements must have `when' or `else'");
}
}