Skip to content

Commit 57af3f3

Browse files
committed
Remove ViewModelTypeName from ReactiveObjectInfo
Eliminated the ViewModelTypeName property from the ReactiveObjectInfo record and updated the generator logic to reflect this change. This simplifies the model and generator by removing unused or unnecessary data.
1 parent f9b1b61 commit 57af3f3

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/ReactiveUI.SourceGenerators.Roslyn/ReactiveObject/Models/ReactiveObjectInfo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ namespace ReactiveUI.SourceGenerators.Models;
99
/// A model with gathered info on a given command method.
1010
/// </summary>
1111
internal sealed record ReactiveObjectInfo(
12-
TargetInfo TargetInfo,
13-
string ViewModelTypeName);
12+
TargetInfo TargetInfo);

src/ReactiveUI.SourceGenerators.Roslyn/ReactiveObject/ReactiveObjectGenerator.Execute.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,18 @@ public partial class ReactiveObjectGenerator
3232
var symbol = context.TargetSymbol;
3333
token.ThrowIfCancellationRequested();
3434

35-
if (!symbol.TryGetAttributeWithFullyQualifiedMetadataName(AttributeDefinitions.ReactiveObjectAttributeType, out var attributeData))
36-
{
37-
return default;
38-
}
39-
40-
token.ThrowIfCancellationRequested();
4135
if (symbol is not INamedTypeSymbol classSymbol)
4236
{
4337
return default;
4438
}
4539

46-
var constructorArgument = attributeData.GetConstructorArguments<string>().FirstOrDefault();
47-
var genericArgument = attributeData.GetGenericType();
48-
token.ThrowIfCancellationRequested();
49-
var viewModelTypeName = string.IsNullOrWhiteSpace(constructorArgument) ? genericArgument : constructorArgument;
50-
if (string.IsNullOrWhiteSpace(viewModelTypeName))
51-
{
52-
return default;
53-
}
54-
5540
token.ThrowIfCancellationRequested();
5641

5742
// Get the containing type info
5843
var targetInfo = TargetInfo.From(classSymbol);
5944

6045
token.ThrowIfCancellationRequested();
61-
return new(
62-
targetInfo,
63-
viewModelTypeName!);
46+
return new(targetInfo);
6447
}
6548

6649
private static string GenerateSource(string containingTypeName, string containingNamespace, string containingClassVisibility, string containingType, ReactiveObjectInfo reactiveObjectInfo) =>

0 commit comments

Comments
 (0)