Skip to content

Commit e9ebdb6

Browse files
authored
Fix Forward Attributes to Generated Code (#117)
Fix Forward Attributes To Generated Code Remove Attribute collection and forwarding
1 parent 2960f09 commit e9ebdb6

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/ReactiveUI.SourceGenerators/IViewFor/IViewForGenerator.Execute.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ public partial class IViewForGenerator
5757
return default;
5858
}
5959

60-
var compilation = context.SemanticModel.Compilation;
61-
var semanticModel = compilation.GetSemanticModel(context.SemanticModel.SyntaxTree);
62-
token.ThrowIfCancellationRequested();
63-
attributeData.GatherForwardedAttributesFromClass(semanticModel, declaredClass, token, out var classAttributesInfo);
64-
var forwardedClassAttributes = classAttributesInfo.Select(static a => a.ToString())
65-
.Where(x => !x.Contains(AttributeDefinitions.IViewForAttributeType))
66-
.ToImmutableArray();
6760
token.ThrowIfCancellationRequested();
6861

6962
var viewForBaseType = IViewForBaseType.None;
@@ -105,14 +98,13 @@ public partial class IViewForGenerator
10598
targetInfo.TargetVisibility,
10699
targetInfo.TargetType,
107100
viewModelTypeName!,
108-
viewForBaseType,
109-
forwardedClassAttributes);
101+
viewForBaseType);
110102
}
111103

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

117109
switch (iviewForInfo.BaseType)
118110
{

src/ReactiveUI.SourceGenerators/IViewFor/Models/IViewForInfo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ internal sealed record IViewForInfo(
1818
string TargetVisibility,
1919
string TargetType,
2020
string ViewModelTypeName,
21-
IViewForBaseType BaseType,
22-
EquatableArray<string> ForwardedAttributes);
21+
IViewForBaseType BaseType);

0 commit comments

Comments
 (0)