Skip to content

Commit f912e0a

Browse files
committed
Fixed build error.
1 parent e7d78f4 commit f912e0a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Magick.NET.SourceGenerator/MagickColors/MagickColorsGenerator.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
2121
{
2222
context.RegisterPostInitializationOutput(context => context.AddAttributeSource<MagickColorsAttribute>());
2323

24-
var type = typeof(Color);
24+
var colorType = typeof(Color);
25+
var colorFullName = colorType.FullName ?? throw new InvalidOperationException();
26+
2527
var colors = context.CompilationProvider
2628
.Select((compilation, _) => compilation
27-
.GetTypesByMetadataName(type.FullName).Single()
29+
.GetTypesByMetadataName(colorFullName).Single()
2830
.GetMembers().OfType<IPropertySymbol>()
29-
.Where(property => property.Type.Name == type.Name)
31+
.Where(property => property.Type.Name == colorType.Name)
3032
.Select(property => property.Name)
3133
.ToImmutableArray());
3234

33-
var fullName = typeof(MagickColorsAttribute).FullName ?? throw new InvalidOperationException();
34-
var info = context.SyntaxProvider.ForAttributeWithMetadataName(fullName, (_, _) => true, (syntaxContext, _) => CheckForInterface(syntaxContext));
35+
var attributeFullName = typeof(MagickColorsAttribute).FullName ?? throw new InvalidOperationException();
36+
var info = context.SyntaxProvider.ForAttributeWithMetadataName(attributeFullName, (_, _) => true, (syntaxContext, _) => CheckForInterface(syntaxContext));
3537
var combinedInfo = info.Combine(colors);
3638

3739
context.RegisterSourceOutput(combinedInfo, GenerateCode);

0 commit comments

Comments
 (0)