示例#1
0
        public override void VisitCFGTryCatchEdge(TryCatchEdge x)
        {
            // .Accept() on BodyBlocks traverses not only the try block but also the rest of the code
            ++inTryLevel;
            var hasEndBlock = (x.NextBlock != null);                // if there's a block directly after try-catch-finally

            if (hasEndBlock)
            {
                endOfTryBlocks.Push(x.NextBlock);
            }                                                       // -> add it as ending block
            x.BodyBlock.Accept(this);
            if (!hasEndBlock)
            {
                --inTryLevel;
            }                                                       // if there isn't dicrease tryLevel after going trough the try & rest (nothing)

            foreach (var c in x.CatchBlocks)
            {
                ++inCatchLevel;
                c.Accept(this);
                --inCatchLevel;
            }


            if (x.FinallyBlock != null)
            {
                ++inFinallyLevel;
                x.FinallyBlock.Accept(this);
                --inFinallyLevel;
            }
        }
示例#2
0
        public override void VisitCFGTryCatchEdge(TryCatchEdge x)
        {
            var state = _state;

            TraverseToBlock(state, x.BodyBlock);

            foreach (var c in x.CatchBlocks)
            {
                TraverseToBlock(state, c);
            }

            if (x.FinallyBlock != null)
            {
                TraverseToBlock(state, x.FinallyBlock);
            }
        }
示例#3
0
        public override void VisitCFGTryCatchEdge(TryCatchEdge x)
        {
            var state = _state;

            // TODO: any expression inside try{} block can traverse to catch{} or finally{}.

            //
            TraverseToBlock(x, state, x.BodyBlock);

            //
            state.SetAllUnknown(true);  // TODO: traverse from all states in try{} instead of setting variables unknown here

            foreach (var c in x.CatchBlocks)
            {
                TraverseToBlock(x, state, c);
            }

            if (x.FinallyBlock != null)
            {
                TraverseToBlock(x, state, x.FinallyBlock);
            }
        }
示例#4
0
        public override void VisitCFGTryCatchEdge(TryCatchEdge x)
        {
            // remember scopes,
            // .Accept() on BodyBlocks traverses not only the try block but also the rest of the code

            WithScope(new Scope
            {
                ScopeKind = Scope.Kind.Try,
                From      = x.BodyBlock.Ordinal,
                To        = x.NextBlock.Ordinal
            });

            for (int i = 0; i < x.CatchBlocks.Length; i++)
            {
                WithScope(new Scope
                {
                    ScopeKind = Scope.Kind.Catch,
                    From      = x.CatchBlocks[i].Ordinal,
                    To        = ((i + 1 < x.CatchBlocks.Length) ? x.CatchBlocks[i + 1] : x.FinallyBlock ?? x.NextBlock).Ordinal,
                });
            }

            if (x.FinallyBlock != null)
            {
                WithScope(new Scope
                {
                    ScopeKind = Scope.Kind.Finally,
                    From      = x.FinallyBlock.Ordinal,
                    To        = x.NextBlock.Ordinal
                });
            }

            // visit:

            base.VisitCFGTryCatchEdge(x);
        }
示例#5
0
 public override T VisitCFGTryCatchEdge(TryCatchEdge x)
 {
     return base.VisitCFGTryCatchEdge(x);
 }