Skip to content

Commit

Permalink
Fix Forward Attributes to Generated Code (#117)
Browse files Browse the repository at this point in the history
Fix Forward Attributes To Generated Code

Remove Attribute collection and forwarding
  • Loading branch information
ChrisPulman authored Nov 7, 2024
1 parent 2960f09 commit e9ebdb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ public partial class IViewForGenerator
return default;
}

var compilation = context.SemanticModel.Compilation;
var semanticModel = compilation.GetSemanticModel(context.SemanticModel.SyntaxTree);
token.ThrowIfCancellationRequested();
attributeData.GatherForwardedAttributesFromClass(semanticModel, declaredClass, token, out var classAttributesInfo);
var forwardedClassAttributes = classAttributesInfo.Select(static a => a.ToString())
.Where(x => !x.Contains(AttributeDefinitions.IViewForAttributeType))
.ToImmutableArray();
token.ThrowIfCancellationRequested();

var viewForBaseType = IViewForBaseType.None;
Expand Down Expand Up @@ -105,14 +98,13 @@ public partial class IViewForGenerator
targetInfo.TargetVisibility,
targetInfo.TargetType,
viewModelTypeName!,
viewForBaseType,
forwardedClassAttributes);
viewForBaseType);
}

private static string GenerateSource(string containingTypeName, string containingNamespace, string containingClassVisibility, string containingType, IViewForInfo iviewForInfo)
{
// Prepare any forwarded property attributes
var forwardedAttributesString = string.Join("\n ", excludeFromCodeCoverage.Concat(iviewForInfo.ForwardedAttributes));
var forwardedAttributesString = string.Join("\n ", excludeFromCodeCoverage);

switch (iviewForInfo.BaseType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ internal sealed record IViewForInfo(
string TargetVisibility,
string TargetType,
string ViewModelTypeName,
IViewForBaseType BaseType,
EquatableArray<string> ForwardedAttributes);
IViewForBaseType BaseType);

0 comments on commit e9ebdb6

Please sign in to comment.