Skip to content

Commit

Permalink
fix: Add missing AttachedDependencyPropertyAttribute`1 generator in S…
Browse files Browse the repository at this point in the history
…taticConstructorGenerator (#54)
  • Loading branch information
noliar authored Jul 23, 2024
1 parent 0cd4af8 commit 4d297a1
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
.CollectAsEquatableArray();

var adp2 = context.SyntaxProvider
.ForAttributeWithMetadataNameOfClassesAndRecords("DependencyPropertyGenerator.AttachedDependencyPropertyAttribute`1")
.SelectManyAllAttributesOfCurrentClassSyntax()
.Combine(framework)
.Combine(version)
.SelectAndReportExceptions(static (x, _) => PrepareData(x, isAttached: true), context, Id)
.WhereNotNull()
.CollectAsEquatableArray();

var adp3 = context.SyntaxProvider
.ForAttributeWithMetadataNameOfClassesAndRecords("DependencyPropertyGenerator.AttachedDependencyPropertyAttribute`2")
.SelectManyAllAttributesOfCurrentClassSyntax()
.Combine(framework)
Expand All @@ -70,9 +79,9 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
.CollectAsEquatableArray();
// A type can have only one static constructor, so combined all four attributes.
// Is there a better performance way?
dp1.Combine(dp2.Combine(adp1.Combine(adp2))).Select((x, _) =>
dp1.Combine(dp2.Combine(adp1.Combine(adp2.Combine(adp3)))).Select((x, _) =>
{
return x.Left.AsImmutableArray().AddRange(x.Right.Left).AddRange(x.Right.Right.Left).AddRange(x.Right.Right.Right).AsEquatableArray();
return x.Left.AsImmutableArray().AddRange(x.Right.Left).AddRange(x.Right.Right.Left).AddRange(x.Right.Right.Right.Left).AddRange(x.Right.Right.Right.Right).AsEquatableArray();
}).SelectAndReportExceptions(GetSourceCode, context, Id)
.AddSource(context);
}
Expand Down

0 comments on commit 4d297a1

Please sign in to comment.