示例#1
0
        // IfStmt
        public override bool Walk(IfStmt node)
        {
            BitArray result = new BitArray(bits.Length, true);
            BitArray save   = bits;

            bits = new BitArray(bits.Length);

            foreach (IfStmtTest ist in node.tests)
            {
                // Set the initial branch value to bits
                bits.SetAll(false);
                bits.Or(save);

                // Flow the test first
                ist.test.Walk(this);
                // Flow the body
                ist.body.Walk(this);
                // Intersect
                result.And(bits);
            }

            // Set the initial branch value to bits
            bits.SetAll(false);
            bits.Or(save);

            if (node.elseStmt != null)
            {
                // Flow the else_
                node.elseStmt.Walk(this);
            }

            // Intersect
            result.And(bits);

            bits = save;

            // Remember the result
            bits.SetAll(false);
            bits.Or(result);
            return(false);
        }
 public virtual void PostWalk(IfStmt node)
 {
 }
 // IfStmt
 public virtual bool Walk(IfStmt node)
 {
     return(true);
 }
 // IfStmt
 public virtual bool Walk(IfStmt node)
 {
     return(false);
 }