示例#1
0
 public void Visit(DoWhile node)
 {
     // invalid! ignore
     IsValid = false;
 }
 public void Visit(DoWhile node)
 {
     Debug.Fail("shouldn't get here");
 }
 public void Visit(DoWhile node)
 {
     // invalid! ignore
     IsValid = false;
 }
 private void DoDoWhile(DoWhile node)
 {
     if (m_parser.Settings.IsModificationAllowed(TreeModifications.EvaluateNumericExpressions))
     {
         // if the condition is a constant, we can simplify things
         ConstantWrapper constantCondition = node.Condition as ConstantWrapper;
         if (constantCondition != null && constantCondition.IsNotOneOrPositiveZero)
         {
             try
             {
                 // the condition is a constant, so it is always either true or false
                 // we can replace the condition with a one or a zero -- only one byte
                 node.Condition =
                     new ConstantWrapper(constantCondition.ToBoolean() ? 1 : 0, PrimitiveType.Number, node.Condition.Context, m_parser);
             }
             catch (InvalidCastException)
             {
                 // ignore any invalid cast errors
             }
         }
     }
 }
示例#5
0
 public void Visit(DoWhile node)
 {
     // not applicable; terminate
 }
        public override void Visit(DoWhile node)
        {
            if (node != null)
            {
                // depth-first
                base.Visit(node);

                DoDoWhile(node);
            }
        }
        public void Visit(DoWhile node)
        {
            if (node != null)
            {
                node.Index = NextOrderIndex;
                if (node.Body != null)
                {
                    node.Body.Accept(this);
                }

                if (node.Condition != null)
                {
                    node.Condition.Accept(this);
                }
            }
        }
 public void Visit(DoWhile node)
 {
     Debug.Fail("shouldn't get here");
 }
 public void Visit(DoWhile node)
 {
     // not applicable; terminate
 }
        public override void Visit(DoWhile node)
        {
            if (node != null)
            {
                // if we are stripping debugger statements and the body is
                // just a debugger statement, replace it with a null
                if (m_parser.Settings.StripDebugStatements
                     && m_parser.Settings.IsModificationAllowed(TreeModifications.StripDebugStatements)
                     && node.Body != null
                     && node.Body.IsDebuggerStatement)
                {
                    node.Body = null;
                }

                // recurse
                base.Visit(node);

                // if the body is now empty, make it null
                if (node.Body != null && node.Body.Count == 0)
                {
                    node.Body = null;
                }
            }
        }