Skip to content

Commit

Permalink
Remove debugging logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
GGG-KILLER committed Jan 29, 2024
1 parent 1ca2adb commit 7402d16
Showing 1 changed file with 30 additions and 37 deletions.
67 changes: 30 additions & 37 deletions Tsu.Trees.RedGreen/sourcegen/RedTreeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,45 @@ public static void RegisterRedSyntaxOutput(this IncrementalGeneratorInitializati
{
context.RegisterSourceOutput(trees, (ctx, tree) =>
{
try
{
var builder = new StringBuilder();
var writer = new IndentedTextWriter(new StringWriter(builder));
var builder = new StringBuilder();
var writer = new IndentedTextWriter(new StringWriter(builder));

writer.WriteLine("// <auto-generated />");
writer.WriteLineNoTabs("");
writer.WriteLine("// <auto-generated />");
writer.WriteLineNoTabs("");

writer.WriteLine("#nullable enable");
writer.WriteLineNoTabs("");
writer.WriteLine("#nullable enable");
writer.WriteLineNoTabs("");

writer.WriteLine("using System.Diagnostics;");
writer.WriteLine("using System.Diagnostics.CodeAnalysis;");
writer.WriteLine("using System.Linq;");
writer.WriteLineNoTabs("");
writer.WriteLine("using System.Diagnostics;");
writer.WriteLine("using System.Diagnostics.CodeAnalysis;");
writer.WriteLine("using System.Linq;");
writer.WriteLineNoTabs("");

writer.WriteLine("namespace {0}", tree.RedBase.ContainingNamespace.ToCSharpString());
writer.WriteLine('{');
writer.Indent++;
{
writer.WriteRedRoot(tree, tree.Root);
writer.WriteLine("namespace {0}", tree.RedBase.ContainingNamespace.ToCSharpString());
writer.WriteLine('{');
writer.Indent++;
{
writer.WriteRedRoot(tree, tree.Root);

var stack = new Stack<Node>();
foreach (var desc in tree.Root.Descendants)
var stack = new Stack<Node>();
foreach (var desc in tree.Root.Descendants)
stack.Push(desc);
while (stack.Count > 0)
{
var node = stack.Pop();
foreach (var desc in node.Descendants)
stack.Push(desc);
while (stack.Count > 0)
{
var node = stack.Pop();
foreach (var desc in node.Descendants)
stack.Push(desc);

writer.WriteLineNoTabs("");
writer.WriteRedNode(tree, node);
}
writer.WriteLineNoTabs("");
writer.WriteRedNode(tree, node);
}
writer.Indent--;
writer.WriteLine('}');
writer.WriteLineNoTabs("");

writer.Flush();
ctx.AddSource($"{tree.Suffix}.Red.g.cs", builder.ToSourceText());
}
catch (Exception ex)
{
D.WriteLine(ex.ToString());
}
writer.Indent--;
writer.WriteLine('}');
writer.WriteLineNoTabs("");

writer.Flush();
ctx.AddSource($"{tree.Suffix}.Red.g.cs", builder.ToSourceText());
});
}

Expand Down

0 comments on commit 7402d16

Please sign in to comment.