Skip to content

Commit b0f2e5a

Browse files
authored
Improve AlsoNotify handling in ReactiveGenerator (#356)
* Improve AlsoNotify handling in ReactiveGenerator Refactors the logic for extracting AlsoNotify property names from [Reactive] attributes to be more robust, handling various constructor argument forms and fallback scenarios. Adds validation in test helpers to ensure generated code includes property change notifications for all AlsoNotify properties specified via nameof(). Updates test baselines to reflect improved code generation. * Prevent empty source files in IViewForGenerator Adds a check to only generate source files when a supported UI framework base type is detected, avoiding creation of empty generated files.
1 parent 425a3d8 commit b0f2e5a

File tree

16 files changed

+177
-56
lines changed

16 files changed

+177
-56
lines changed

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveFromPartialWithAlsoNotify#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_test4"/>
@@ -20,6 +19,7 @@ public int Test4
2019
set
2120
{
2221
this.RaiseAndSetIfChanged(ref _test4, value);
22+
this.RaisePropertyChanged(nameof(OtherNotifyProperty));
2323
}
2424
}
2525
}

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_test3"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperties#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_test1"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesCalledValue#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="this.value"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAccess#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_test2"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAttributesAccessAndInheritance#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_name"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs1.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs1
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_name"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs2.TestVM.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs2
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_name"/>

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithInit#TestNs.TestVM.Properties.g.verified.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
namespace TestNs
99
{
10-
11-
public partial class TestVM
10+
public partial class TestVM
1211
{
1312

1413
/// <inheritdoc cref="_mustBeSet"/>
@@ -25,4 +24,4 @@ public string MustBeSet
2524
}
2625
}
2726
#nullable restore
28-
#pragma warning restore
27+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass1.Properties.g.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace TestNs1
99
{
1010
public partial class TestViewModel3
1111
{
12-
1312
public partial class TestInnerClass1
1413
{
1514

@@ -41,4 +40,4 @@ public int TestInner11
4140

4241
}
4342
#nullable restore
44-
#pragma warning restore
43+
#pragma warning restore

0 commit comments

Comments
 (0)