Exemplo n.º 1
0
 /// <summary>
 /// Called when the walker visits a trivia syntax.  This method may be overridden if
 /// subclasses want to handle the token.  Overrides should call back into this base method if
 /// they want the children of this trivia syntax to be visited.
 /// </summary>
 /// <param name="trivia">The current trivia syntax that the walker is visiting.</param>
 protected virtual void VisitTrivia(SyntaxTrivia trivia)
 {
     if (this.Depth >= SyntaxWalkerDepth.StructuredTrivia && trivia.HasStructure)
     {
         this.Visit(trivia.GetStructure());
     }
 }
Exemplo n.º 2
0
        private bool TryGetLastTokenForStructuredTrivia(
            SyntaxTrivia trivia,
            Func <SyntaxToken, bool> predicate,
            Func <SyntaxTrivia, bool> stepInto,
            out SyntaxToken token)
        {
            token = default(SyntaxToken);

            if (!trivia.HasStructure || stepInto == null || !stepInto(trivia))
            {
                return(false);
            }

            token = GetLastToken(trivia.GetStructure(), predicate, stepInto);

            return(token.RawKind != None);
        }