示例#1
0
        private HandlerBlock CreateHandlerBlock(IMethod method, IMethodContext context, IInstructionList code, SEHBlock block)
        {
            switch (block.Type)
            {
            case SEHFlags.Catch:
            {
                int token = block.Value;

                var type = context.ResolveType(method, token);
                if (!HasGenericExceptions && type.IsGenericContext())
                {
                    _genericFlags |= GenericFlags.HasGenericExceptions;
                }

                var h = new HandlerBlock(BlockType.Catch)
                {
                    ExceptionType = type
                };
                return(h);
            }

            case SEHFlags.Filter:
            {
                var h = new HandlerBlock(BlockType.Filter)
                {
                    FilterIndex = code.GetOffsetIndex(block.Value)
                };
                return(h);
            }

            case SEHFlags.Finally:
                return(new HandlerBlock(BlockType.Finally));

            case SEHFlags.Fault:
                return(new HandlerBlock(BlockType.Fault));

            default:
                throw new IndexOutOfRangeException();
            }
        }
示例#2
0
 public int IndexOf(HandlerBlock handlerBlock)
 {
     return(_list.IndexOf(handlerBlock));
 }
示例#3
0
 public void Add(HandlerBlock block)
 {
     block.Owner = Owner;
     _list.Add(block);
 }