Skip to content

Commit 4a1a285

Browse files
rafact: prepare for IIncrementalGenerator
#52
1 parent 6a63ad5 commit 4a1a285

19 files changed

+1494
-2119
lines changed

Src/StackMemoryCollections/AttributeProcessor.cs

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

Src/StackMemoryCollections/Generator.cs

Lines changed: 3 additions & 431 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
using Microsoft.CodeAnalysis;
22
using System.Collections.Generic;
3-
using System.Text;
43

54
namespace StackMemoryCollections
65
{
7-
public partial class Generator
6+
public class CommonHelpersGenerator
87
{
9-
private void GenerateCommonHelpers(
8+
public void GenerateCommonHelpers(
109
in List<INamedTypeSymbol> typeHelpers,
11-
in GeneratorExecutionContext context,
12-
in StringBuilder builder
10+
in GeneratorExecutionContext context
1311
)
1412
{
1513
if (typeHelpers.Count == 0)
1614
{
1715
return;
1816
}
19-
builder.Clear();
20-
builder.Append($@"
21-
/*
22-
{Resource.License}
23-
*/
2417

18+
var code = $@"
2519
using System;
2620
using System.Runtime.CompilerServices;
2721
@@ -35,9 +29,9 @@ public static bool IsNull(in void* ptr)
3529
}}
3630
}}
3731
}}
38-
");
32+
";
3933

40-
context.AddSource($"CommonHelper.g.cs", builder.ToString());
34+
context.AddSource($"CommonHelper.g.cs", code);
4135
}
4236
}
4337
}

0 commit comments

Comments
 (0)