Skip to content

Commit 18c9e26

Browse files
fix merge issues
1 parent f6bf761 commit 18c9e26

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

AutomaticInterface/AutomaticInterface/Builder.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

AutomaticInterface/AutomaticInterfaceExample/AutomaticInterfaceExample.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,4 @@
1818
<ItemGroup>
1919
<Folder Include="logs" />
2020
</ItemGroup>
21-
22-
<ItemGroup>
23-
24-
<None Remove="logs\AutomaticInterfaceGenerator_log.txt" />
25-
</ItemGroup>
26-
2721
</Project>

0 commit comments

Comments
 (0)