public ProtectedRegion(BasicBlocks basicBlocks, MosaExceptionHandler exceptionHandler) { this.Handler = exceptionHandler; foreach (var block in basicBlocks) { if (block.Label >= exceptionHandler.TryStart && block.Label < exceptionHandler.TryEnd) { included.Add(block); } else { excluded.Add(block); } } }
protected MosaExceptionHandler FindFinallyExceptionContext(InstructionNode node) { MosaExceptionHandler innerClause = null; int label = node.Label; foreach (var handler in MethodCompiler.Method.ExceptionHandlers) { if (handler.IsLabelWithinHandler(label)) { return(handler); } } return(null); }
protected MosaExceptionHandler FindNextEnclosingFinallyHandler(MosaExceptionHandler exceptionHandler) { var index = Method.ExceptionHandlers.IndexOf(exceptionHandler); var at = exceptionHandler.TryStart; for (int i = index + 1; i < Method.ExceptionHandlers.Count; i++) { var entry = Method.ExceptionHandlers[i]; if (entry.ExceptionHandlerType != ExceptionHandlerType.Finally || !entry.IsLabelWithinTry(at)) { continue; } return(entry); } return(null); }
protected MosaExceptionHandler FindNextEnclosingFinallyContext(MosaExceptionHandler exceptionContext) { int index = MethodCompiler.Method.ExceptionHandlers.IndexOf(exceptionContext); for (int i = index + 1; i < MethodCompiler.Method.ExceptionHandlers.Count; i++) { var entry = MethodCompiler.Method.ExceptionHandlers[i]; if (!entry.IsLabelWithinTry(exceptionContext.TryStart)) { return(null); } if (entry.ExceptionHandlerType != ExceptionHandlerType.Finally) { continue; } return(entry); } return(null); }