@@ -17,6 +17,7 @@ namespace CommunityToolkit.Labs.Core.SourceGenerators;
1717public class ToolkitSampleOptionGenerator : IIncrementalGenerator
1818{
1919 private readonly HashSet < string > _handledPropertyNames = new ( ) ;
20+ private readonly HashSet < ToolkitSampleOptionBaseAttribute > _handledAttributes = new ( ) ;
2021 private readonly HashSet < ISymbol > _handledContainingClasses = new ( SymbolEqualityComparer . Default ) ;
2122
2223 public void Initialize ( IncrementalGeneratorInitializationContext context )
@@ -59,13 +60,13 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
5960 ctx . AddSource ( $ "{ data . ContainingClassSymbol } .GeneratedPropertyContainer.g", propertyContainerSource ) ;
6061 }
6162
62- var name = $ "{ data . ContainingClassSymbol } .Property.{ data . Attribute . Name } .g";
63+ if ( ! _handledAttributes . Add ( data . Attribute ) )
64+ return ;
6365
64- if ( _handledPropertyNames . Add ( name ) )
65- {
66- var dependencyPropertySource = BuildProperty ( data . ContainingClassSymbol , data . Attribute . Name , data . Attribute . TypeName , data . Type ) ;
67- ctx . AddSource ( name , dependencyPropertySource ) ;
68- }
66+ var dependencyPropertySource = BuildProperty ( data . ContainingClassSymbol , data . Attribute . Name , data . Attribute . TypeName , data . Type ) ;
67+
68+ if ( _handledPropertyNames . Add ( data . Attribute . Name ) )
69+ ctx . AddSource ( $ "{ data . ContainingClassSymbol } .Property.{ data . Attribute . Name } .g", dependencyPropertySource ) ;
6970 } ) ;
7071
7172 }
@@ -108,6 +109,7 @@ public partial class {containingClassSymbol.Name} : {typeof(IToolkitSampleGenera
108109 item.PropertyChanged -= OnPropertyChanged;
109110 }}
110111
112+
111113 if (!(value is null))
112114 {{
113115 foreach (var item in value)
0 commit comments