Example #1
0
 public virtual void Visit(ConditionalCompilationComment node)
 {
     if (node != null)
     {
          AcceptChildren(node);
     }
 }
 public virtual void Visit(ConditionalCompilationComment node)
 {
     if (node != null)
     {
         if (node.Statements != null)
         {
             node.Statements.Accept(this);
         }
     }
 }
Example #3
0
 public override void Visit(ConditionalCompilationComment node)
 {
     if (node != null && node.Statements != null && node.Statements.Count > 0)
     {
         // increment the conditional comment level, recurse (process all the
         // statements), then decrement the level when we are through.
         ++m_conditionalCommentLevel;
         base.Visit(node);
         --m_conditionalCommentLevel;
     }
 }
Example #4
0
        // unnest any child blocks
        private static void UnnestBlocks(BlockStatement node)
        {
            // walk the list of items backwards -- if we come
            // to any blocks, unnest the block recursively.
            // Remove any empty statements as well.
            // We walk backwards because we could be adding any number of statements
            // and we don't want to have to modify the counter.
            for (int ndx = node.Count - 1; ndx >= 0; --ndx)
            {
                var nestedBlock = node[ndx] as BlockStatement;
                if (nestedBlock != null)
                {
                    // unnest recursively
                    UnnestBlocks(nestedBlock);

                    // if the block has a block scope, then we can't really unnest it
                    // without merging lexical scopes
                    if (!nestedBlock.HasOwnScope)
                    {
                        // remove the nested block
                        node.RemoveAt(ndx);

                        // then start adding the statements in the nested block to our own.
                        // go backwards so we can just keep using the same index
                        node.InsertRange(ndx, nestedBlock.Children);
                    }
                }
                else if (node[ndx] is EmptyStatement)
                {
                    // remove empty statements (lone semicolons)
                    node.RemoveAt(ndx);
                }
                else if (ndx > 0)
                {
                    // see if the previous node is a conditional-compilation comment, because
                    // we will also combine adjacent those
                    var previousComment = node[ndx - 1] as ConditionalCompilationComment;
                    if (previousComment != null)
                    {
                        ConditionalCompilationComment thisComment = node[ndx] as ConditionalCompilationComment;
                        if (thisComment != null)
                        {
                            // two adjacent conditional comments -- combine them into the first.
                            previousComment.Statements.Append(thisComment.Statements);

                            // and remove the second one (which is now a duplicate)
                            node.RemoveAt(ndx);
                        }
                    }
                }
            }
        }
 public void Visit(ConditionalCompilationComment node)
 {
     if (node != null)
     {
         if (node.Statements.IfNotNull(s => s.Count > 0))
         {
             node.Statements[node.Statements.Count - 1].Accept(this);
         }
         else
         {
             DoesRequire = true;
         }
     }
 }
Example #6
0
 public void Visit(ConditionalCompilationComment node)
 {
     if (node != null)
     {
         // recurse the children, but as soon as we get the flag set to true, bail
         foreach (var child in node.Children)
         {
             child.Accept(this);
             if (m_needsParens)
             {
                 break;
             }
         }
     }
 }
 public void Visit(ConditionalCompilationComment node)
 {
     // not applicable; terminate
 }
Example #8
0
 public void Visit(ConditionalCompilationComment node)
 {
     // starts with a '/*@' or '//@', so we don't care
 }
Example #9
0
 public void Visit(ConditionalCompilationComment node)
 {
     ReportError(node);
 }
Example #10
0
 public void Visit(ConditionalCompilationComment node)
 {
     // invalid! ignore
     IsValid = false;
 }
Example #11
0
 public virtual void Visit(ConditionalCompilationComment node)
 {
     if (node != null)
     {
         if (node.Statements != null)
         {
             node.Statements.Accept(this);
         }
     }
 }