Skip to content

Commit

Permalink
Remove debug logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
GGG-KILLER committed Jan 22, 2024
1 parent 205ae8c commit 0a2eb7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
12 changes: 0 additions & 12 deletions Tsu.TreeSourceGen/sample/logs.txt

This file was deleted.

12 changes: 2 additions & 10 deletions Tsu.TreeSourceGen/src/GeneratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,14 @@ public static IncrementalValuesProvider<Tree> GetTrees(this IncrementalGenerator
(node, _) => node.IsKind(SyntaxKind.ClassDeclaration),
(ctx, _) =>
{
Log.WriteLine($"Processing {ctx.TargetSymbol} for [TreeNode]");
var attr = ctx.Attributes.SingleOrDefault();
var firstArg = attr?.ConstructorArguments.Single().Value as INamedTypeSymbol;
var nodeSymbol = (INamedTypeSymbol) ctx.TargetSymbol;

// Only accept symbol arguments
if (firstArg is null || firstArg.TypeKind != TypeKind.Class
if (attr?.ConstructorArguments.Single().Value is not INamedTypeSymbol firstArg
|| firstArg.TypeKind != TypeKind.Class
|| (nodeSymbol.IsAbstract && !SymbolEqualityComparer.Default.Equals(firstArg, ctx.TargetSymbol)))
{
var b = new StringBuilder(" Discarded. ");
b.Append($"{{ IsNamedType = {firstArg is not null}");
b.Append($", IsClassKind = {firstArg is { TypeKind: TypeKind.Class }}");
b.Append($", IsAbstract = {nodeSymbol is { IsAbstract: true }}");
b.Append($", IsRoot = {SymbolEqualityComparer.Default.Equals(firstArg as INamedTypeSymbol, ctx.TargetSymbol)} }}");
Log.WriteLine(b.ToString());
return (null!, null!, null!, null);
}

Expand All @@ -40,7 +33,6 @@ public static IncrementalValuesProvider<Tree> GetTrees(this IncrementalGenerator
name = n;
}

Log.WriteLine(" Added.");
return (
Root: firstArg,
ParentClass: ((ClassDeclarationSyntax) ctx.TargetNode).GetContainingTypes(),
Expand Down

0 comments on commit 0a2eb7f

Please sign in to comment.