Ejemplo n.º 1
0
        public static int CountNodes(this INode ast)
        {
            var visitor = new NodeCountingVisitor();

            ast.AcceptVisitor(visitor, null);
            return(visitor.NodeCount);
        }
 // This is an extension method because this assembly is trimmed at a "type granular" level in Blazor,
 // and the whole DependencyInjectionEventSource type can't be trimmed. So extracting this to a separate
 // type allows for the System.Linq.Expressions usage to be trimmed by the ILLinker.
 public static void ExpressionTreeGenerated(this DependencyInjectionEventSource source, Type serviceType, Expression expression)
 {
     if (source.IsEnabled(EventLevel.Verbose, EventKeywords.All))
     {
         var visitor = new NodeCountingVisitor();
         visitor.Visit(expression);
         source.ExpressionTreeGenerated(serviceType.ToString(), visitor.NodeCount);
     }
 }
 public void ExpressionTreeGenerated(Type serviceType, Expression expression)
 {
     if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
     {
         var visitor = new NodeCountingVisitor();
         visitor.Visit(expression);
         ExpressionTreeGenerated(serviceType.ToString(), visitor.NodeCount);
     }
 }