示例#1
0
        public override void Visit(ForIn 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.ReplaceChild(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.ReplaceChild(node.Body, null);
                }
            }
        }