@@ -53,11 +53,13 @@ is not ClassDeclarationSyntax classSyntax
5353 return string . Empty ;
5454 }
5555 var generationAttribute = GetGenerationAttribute ( typeSymbol ) ;
56- var namespaceName = GetNameSpace ( typeSymbol , generationAttribute ) ;
5756 var asInternal = GetAsInternal ( generationAttribute ) ;
58- var interfaceName = $ "I{ classSyntax . GetClassName ( ) } ";
59-
60- var interfaceGenerator = new InterfaceBuilder ( namespaceName , interfaceName , asInternal ) ;
57+ var symbolDetails = GetSymbolDetails ( typeSymbol , classSyntax ) ;
58+ var interfaceGenerator = new InterfaceBuilder (
59+ symbolDetails . NamespaceName ,
60+ symbolDetails . InterfaceName ,
61+ asInternal
62+ ) ;
6163
6264 interfaceGenerator . AddClassDocumentation ( GetDocumentationForClass ( classSyntax ) ) ;
6365 interfaceGenerator . AddGeneric ( GetGeneric ( classSyntax , namedTypeSymbol ) ) ;
@@ -115,6 +117,21 @@ private static bool GetAsInternal(AttributeData? generationAttribute)
115117 return asInternal . GetValueOrDefault ( ) ;
116118 }
117119
120+ private static GeneratedSymbolDetails GetSymbolDetails (
121+ ITypeSymbol typeSymbol ,
122+ ClassDeclarationSyntax classSyntax
123+ )
124+ {
125+ var generationAttribute = typeSymbol
126+ . GetAttributes ( )
127+ . FirstOrDefault ( x =>
128+ x . AttributeClass != null
129+ && x . AttributeClass . Name . Contains ( AutomaticInterfaceGenerator . DefaultAttributeName )
130+ ) ;
131+
132+ return new GeneratedSymbolDetails ( generationAttribute , typeSymbol , classSyntax ) ;
133+ }
134+
118135 private static void AddMethodsToInterface ( List < ISymbol > members , InterfaceBuilder codeGenerator )
119136 {
120137 members
0 commit comments