Beispiel #1
0
        public static IEnumerable <ISymbol> DescendantNodes(this IVisitableSymbol symbol, Func <ISymbol, bool>?visitChildren = null, Func <ISymbol, bool>?includeSymbol = null)
        {
            var visitor = new CollectAllSymbolsVisitor(
                visitChildren ?? (_ => true),
                includeSymbol ?? (_ => true));

            symbol.Visit(visitor);
            return(visitor.Symbols);
        }
Beispiel #2
0
 protected override object DefaultVisit(IVisitableSymbol symbol)
 {
     if (_includeSymbol(symbol))
     {
         Symbols.Add(symbol);
     }
     if (_visitChildren(symbol))
     {
         return(symbol.Visit(this));
     }
     return(default);