Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes it #13

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions Decomposer/src/aigenerated/TypeDecomposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,30 @@ public void Execute(IncrementalGeneratorExecutionContext context)
// Generate an interface for each public property and method
foreach (var symbol in symbolsForType)
{
switch (symbol)
if (symbol is IPropertySymbol propertySymbol)
{
case IPropertySymbol propertySymbol:
if (propertySymbol.IsReadOnly || propertySymbol.IsWriteOnly)
continue;
var interfaceName = GetInterfaceName(targetType, propertySymbol);
var interfaceSyntax = GenerateInterfaceSyntax(targetType, propertySymbol, interfaceName);
if (propertySymbol.IsReadOnly || propertySymbol.IsWriteOnly)
continue;
var interfaceName = GetInterfaceName(targetType, propertySymbol);
var interfaceSyntax = GenerateInterfaceSyntax(targetType, propertySymbol, interfaceName);
interfaces.Add(interfaceSyntax);
break;
}
else if (symbol is IMethodSymbol)
{
if (methodSymbol.IsAccessor())
continue;
var overloadedMethodSymbols = targetType.GetMembers(methodSymbol.Name)
.OfType<IMethodSymbol>()
.Where(m => SymbolEqualityComparer.Default.Equals(m.ReturnType, methodSymbol.ReturnType)
&& m.Parameters.SequenceEqual(methodSymbol.Parameters, ParameterEqualityComparer.Default));
foreach (var overloadedMethodSymbol in overloadedMethodSymbols)
{
var interfaceName = GetInterfaceName(targetType, overloadedMethodSymbol);
var interfaceSyntax = GenerateInterfaceSyntax(targetType, overloadedMethodSymbol, interfaceName);
interfaces.Add(interfaceSyntax);
break;
case IMethodSymbol methodSymbol:
if (methodSymbol.IsAccessor())
continue;
var overloadedMethodSymbols = targetType.GetMembers(methodSymbol.Name)
.OfType<IMethodSymbol>()
.Where(m => SymbolEqualityComparer.Default.Equals(m.ReturnType, methodSymbol.ReturnType)
&& m.Parameters.SequenceEqual(methodSymbol.Parameters, ParameterEqualityComparer.Default));
foreach (var overloadedMethodSymbol in overloadedMethodSymbols)
{
var interfaceName = GetInterfaceName(targetType, overloadedMethodSymbol);
var interfaceSyntax = GenerateInterfaceSyntax(targetType, overloadedMethodSymbol, interfaceName);
interfaces.Add(interfaceSyntax);
}
break;
}
break;
}
}

Expand Down