in src/PublicToInternalGenerator/PublicToInternalGenerator.cs [76:97]
public override SyntaxNode? VisitAttributeList(AttributeListSyntax node)
{
// Remove [Conditional(...)] attributes from any attribute list
var filteredAttributes = new SeparatedSyntaxList<AttributeSyntax>();
foreach (var attr in node.Attributes)
{
if (!IsConditionalAttribute(attr))
{
filteredAttributes = filteredAttributes.Add(attr);
}
}
if (filteredAttributes.Count == 0)
{
// Drop the entire attribute list when it only contained Conditional
return null; // returning null will remove the node
}
var newNode = node.WithAttributes(filteredAttributes);
return base.VisitAttributeList(newNode);
}