public override void VisitProtect(ProtectStatement protect) { exceptionLevel++; ilGenerator.BeginExceptionBlock(); protect.StatementList.Accept(this); foreach (ProtectWhen when in protect.WhenPartList) { ilGenerator.BeginCatchBlock(when.TypeSpecifier.RawType); LocalBuilder prevException = currentException; currentException = ilGenerator.DeclareLocal(when.TypeSpecifier.RawType); ilGenerator.Emit(OpCodes.Stloc, currentException); when.ThenPart.Accept(this); currentException = prevException; } if (protect.ElsePart != null) { ilGenerator.BeginCatchBlock(typeof(Exception)); LocalBuilder prevException = currentException; currentException = ilGenerator.DeclareLocal(typeof(Exception)); ilGenerator.Emit(OpCodes.Stloc, currentException); protect.ElsePart.Accept(this); currentException = prevException; } ilGenerator.EndExceptionBlock(); exceptionLevel--; }
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'"); } }
public virtual void VisitProtect(ProtectStatement protect) { }