Esempio n. 1
0
        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 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;
        }