Example #1
0
        /// <inheritdoc />
        public void ExtendAtCatchEntry(ISnapshotReadonly[] inputs, CatchBlockDescription catchDescription)
        {
            var snapshots = getSnapshots(inputs);

            // TODO: Snapshot.Extend should accept just SnapshotBase?
            Snapshot.ExtendAtCatchEntry(snapshots, catchDescription);
        }
Example #2
0
        private PointsBlock createChildBlock(BasicBlock block, Queue <PointsBlock> pendingBlocks)
        {
            PointsBlock childBlock;

            childBlock = _context.CreateFromBlock(block);

            var tryBlock = block as TryBasicBlock;

            if (tryBlock != null)
            {
                //block is try block, we have to start scope of its catch blocks
                var catchBlocks = new List <CatchBlockDescription>();
                foreach (var catchBB in tryBlock.catchBlocks)
                {
                    var startingCatch = getChildBlock(catchBB, pendingBlocks);

                    startingCatch.DisallowContraction();

                    var catchVar    = new VariableIdentifier(catchBB.Variable.VarName);
                    var description = new CatchBlockDescription(startingCatch.FirstPoint, catchBB.ClassName, catchVar);
                    catchBlocks.Add(description);
                }

                var scopeStart = _context.CreateCatchScopeStart(catchBlocks);
                childBlock.PreprendFlowWith(scopeStart);
            }

            //find all incomming edges from catch blocks
            var endingCatchBlocks = new List <CatchBlockDescription>();

            foreach (var endingTryBlock in block.EndIngTryBlocks)
            {
                foreach (var endingCatch in endingTryBlock.catchBlocks)
                {
                    var endingCatchBlock = getChildBlock(endingCatch, pendingBlocks);
                    endingCatchBlock.DisallowContraction();

                    var catchVar    = new VariableIdentifier(endingCatch.Variable.VarName);
                    var description = new CatchBlockDescription(endingCatchBlock.FirstPoint, endingCatch.ClassName, catchVar);
                    endingCatchBlocks.Add(description);
                }
            }

            if (endingCatchBlocks.Count > 0)
            {
                var scopeEnd = _context.CreateCatchScopeEnd(endingCatchBlocks);
                childBlock.AppendFlow(scopeEnd);
            }

            if (block.WorklistSegmentStart())
            {
                // get program point that corresponds to the end of the segment
                var afterBlock = getChildBlock(block.AfterWorklistSegment, pendingBlocks);
                childBlock.LastPoint.CreateWorklistSegment(afterBlock.FirstPoint);
            }

            return(childBlock);
        }
Example #3
0
 /// <summary>
 /// Creates new instance of ThrowInfo
 /// </summary>
 /// <param name="catchBlock">inforamation about catchblocks</param>
 /// <param name="throwedValue">possible throwd values</param>
 public ThrowInfo(CatchBlockDescription catchBlock, MemoryEntry throwedValue)
 {
     Catch        = catchBlock;
     ThrowedValue = throwedValue;
 }