Esempio n. 1
0
        public ArrayIndexable(Cci.BlockList blocks)
        {
            this.members = new CfgBlock[blocks.Count];

            for (int i = 0; i < blocks.Count; i++)
            {
                this.members[i] = (CfgBlock)blocks[i];
            }
        }
Esempio n. 2
0
        public override Method VisitMethod(Method method)
        {
            // body might not have been materialized, so make sure we do that first!
            Block body = method.Body;

            if (method == null)
            {
                return(null);
            }
            BlockSorter blockSorter  = new BlockSorter();
            BlockList   sortedBlocks = blockSorter.SortedBlocks;

            this.SucessorBlock      = blockSorter.SuccessorBlock;
            this.StackLocalsAtEntry = new TrivialHashtable();
            this.localsStack        = new LocalsStack();
            ExceptionHandlerList ehandlers = method.ExceptionHandlers;

            for (int i = 0, n = ehandlers == null ? 0 : ehandlers.Count; i < n; i++)
            {
                ExceptionHandler ehandler = ehandlers[i];
                if (ehandler == null)
                {
                    continue;
                }
                Block handlerStart = ehandler.HandlerStartBlock;
                if (handlerStart == null)
                {
                    continue;
                }
                LocalsStack lstack = new LocalsStack();
                this.StackLocalsAtEntry[handlerStart.UniqueKey] = lstack;
                if (ehandler.HandlerType == NodeType.Catch)
                {
                    lstack.exceptionHandlerType = CoreSystemTypes.Object;
                    if (ehandler.FilterType != null)
                    {
                        lstack.exceptionHandlerType = ehandler.FilterType;
                    }
                }
                else if (ehandler.HandlerType == NodeType.Filter)
                {
                    lstack.exceptionHandlerType = CoreSystemTypes.Object;
                    if (ehandler.FilterExpression != null)
                    {
                        lstack = new LocalsStack();
                        lstack.exceptionHandlerType = CoreSystemTypes.Object;
                        this.StackLocalsAtEntry[ehandler.FilterExpression.UniqueKey] = lstack;
                    }
                }
            }
            blockSorter.VisitMethodBody(body);
            for (int i = 0, n = sortedBlocks.Count; i < n; i++)
            {
                Block b = sortedBlocks[i];
                if (b == null)
                {
                    Debug.Assert(false); continue;
                }
                this.VisitBlock(b);
            }
            return(method);
        }