public void AddHandler(IFilteringExceptionHandler handler) { //sanity check switch (handler.HandlerType) { case FilteringExceptionHandlerType.Catch: ExceptionHandlingBlockCatch catchHandler = (ExceptionHandlingBlockCatch)handler; if (catchHandler.Parent != this.Parent) { throw new Exception("Catch handler belongs to different logical construct than the try block"); } break; case FilteringExceptionHandlerType.Filter: ExceptionHandlingBlockFilter filterHandler = (ExceptionHandlingBlockFilter)handler; if (filterHandler.Parent != this.Parent) { throw new Exception("Filter handler belongs to different logical construct than the try block"); } break; } RedirectChildrenToNewParent(new IFilteringExceptionHandler[] { handler }); handlers.Add(handler); FixSuccessors(handler); }
public void AddHandler(IFilteringExceptionHandler handler) { //sanity check switch (handler.HandlerType) { case FilteringExceptionHandlerType.Catch : ExceptionHandlingBlockCatch catchHandler = (ExceptionHandlingBlockCatch)handler; if(catchHandler.Parent != this.Parent) { throw new Exception("Catch handler belongs to different logical construct than the try block"); } break; case FilteringExceptionHandlerType.Filter : ExceptionHandlingBlockFilter filterHandler = (ExceptionHandlingBlockFilter)handler; if (filterHandler.Parent != this.Parent) { throw new Exception("Filter handler belongs to different logical construct than the try block"); } break; } RedirectChildrenToNewParent(new IFilteringExceptionHandler[] { handler }); handlers.Add(handler); FixSuccessors(handler); }
private void FixSuccessors(IFilteringExceptionHandler handler) { if (handler.get_CFGSuccessors().Contains(this.get_Try().get_FirstBlock())) { this.AddToSuccessors(this.get_Try().get_FirstBlock()); } V_0 = handler.get_CFGBlocks().GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = V_0.get_Current(); if (!V_1.get_CFGSuccessors().Contains(this.get_Try().get_FirstBlock())) { continue; } this.AddToPredecessors(V_1); } } finally { ((IDisposable)V_0).Dispose(); } return; }
public void AddHandler(IFilteringExceptionHandler handler) { V_0 = handler.get_HandlerType(); if (V_0 == FilteringExceptionHandlerType.Catch) { if (((ExceptionHandlingBlockCatch)handler).get_Parent() != this.get_Parent()) { throw new Exception("Catch handler belongs to different logical construct than the try block"); } } else { if (V_0 == 1) { if (((ExceptionHandlingBlockFilter)handler).get_Parent() != this.get_Parent()) { throw new Exception("Filter handler belongs to different logical construct than the try block"); } } } stackVariable10 = new IFilteringExceptionHandler[1]; stackVariable10[0] = handler; this.RedirectChildrenToNewParent((IEnumerable<ILogicalConstruct>)stackVariable10); this.handlers.Add(handler); this.FixSuccessors(handler); return; }
public TryCatchFilterLogicalConstruct(BlockLogicalConstruct try, IFilteringExceptionHandler handler) { base(); this.InitiExceptionHandlingLogicalConstruct(try); this.handlers = new List<IFilteringExceptionHandler>(); this.AddHandler(handler); return; }
/// <summary> /// Covers the case when the handler has a jump to the guarded block. /// </summary> /// <param name="handler">The exception handling block.</param> private void FixSuccessors(IFilteringExceptionHandler handler) { /// The handler forms a loop with the try. if (handler.CFGSuccessors.Contains(this.Try.FirstBlock)) { this.AddToSuccessors(this.Try.FirstBlock); } /// Find which CFG block forms the loop and add it to the predecessors collection. foreach (CFGBlockLogicalConstruct cfgChild in handler.CFGBlocks) { if (cfgChild.CFGSuccessors.Contains(this.Try.FirstBlock)) { this.AddToPredecessors(cfgChild); } } }
/// <summary> /// Covers the case when the handler has a jump to the guarded block. /// </summary> /// <param name="handler">The exception handling block.</param> private void FixSuccessors(IFilteringExceptionHandler handler) { /// The handler forms a loop with the try. if(handler.CFGSuccessors.Contains(this.Try.FirstBlock)) { this.AddToSuccessors(this.Try.FirstBlock); } /// Find which CFG block forms the loop and add it to the predecessors collection. foreach (CFGBlockLogicalConstruct cfgChild in handler.CFGBlocks) { if (cfgChild.CFGSuccessors.Contains(this.Try.FirstBlock)) { this.AddToPredecessors(cfgChild); } } }
public TryCatchFilterLogicalConstruct(BlockLogicalConstruct @try, IFilteringExceptionHandler handler) { InitiExceptionHandlingLogicalConstruct(@try); handlers = new List <IFilteringExceptionHandler>(); AddHandler(handler); }
public TryCatchFilterLogicalConstruct(BlockLogicalConstruct @try, IFilteringExceptionHandler handler) { InitiExceptionHandlingLogicalConstruct(@try); handlers = new List<IFilteringExceptionHandler>(); AddHandler(handler); }