-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix For OAPH With Nested Classes (#156)
* Fix For OAPH With Nested Classes Simplify TargetInfo Generate Parent Class Declarations * Update Property builders to remove \ r
- Loading branch information
1 parent
902d429
commit 45490dc
Showing
31 changed files
with
509 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...PropNestedClasses#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//HintName: ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.cs | ||
// Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace ReactiveUI.SourceGenerators; | ||
|
||
/// <summary> | ||
/// ObservableAsPropertyAttribute. | ||
/// </summary> | ||
/// <seealso cref="Attribute" /> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
internal sealed class ObservableAsPropertyAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Gets the name of the property. | ||
/// </summary> | ||
/// <value> | ||
/// The name of the property. | ||
/// </value> | ||
public string? PropertyName { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the Readonly state of the OAPH property. | ||
/// </summary> | ||
/// <value> | ||
/// The is read only of the OAPH property. | ||
/// </value> | ||
public bool ReadOnly { get; init; } = true; | ||
} | ||
#nullable restore | ||
#pragma warning restore |
37 changes: 37 additions & 0 deletions
37
...NestedClasses#TestNs.TestVM+TestVMInner1.ObservableAsPropertyFromObservable.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//HintName: TestNs.TestVM+TestVMInner1.ObservableAsPropertyFromObservable.g.cs | ||
// <auto-generated/> | ||
using ReactiveUI; | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
|
||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner1 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner1 | ||
{ | ||
/// <inheritdoc cref="TestIn1Property"/> | ||
private int _testIn1Property; | ||
|
||
/// <inheritdoc cref="_testIn1PropertyHelper"/> | ||
private ReactiveUI.ObservableAsPropertyHelper<int>? _testIn1PropertyHelper; | ||
|
||
/// <inheritdoc cref="_testIn1Property"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn1Property { get => _testIn1Property = _testIn1PropertyHelper?.Value ?? _testIn1Property; } | ||
|
||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
protected void InitializeOAPH() | ||
{ | ||
_testIn1PropertyHelper = TestIn1!.ToProperty(this, nameof(TestIn1Property)); | ||
} | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
40 changes: 40 additions & 0 deletions
40
...#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsPropertyFromObservable.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//HintName: TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsPropertyFromObservable.g.cs | ||
// <auto-generated/> | ||
using ReactiveUI; | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
|
||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
public partial class TestVMInner2 | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner3 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner3 | ||
{ | ||
/// <inheritdoc cref="TestIn3Property"/> | ||
private int _testIn3Property; | ||
|
||
/// <inheritdoc cref="_testIn3PropertyHelper"/> | ||
private ReactiveUI.ObservableAsPropertyHelper<int>? _testIn3PropertyHelper; | ||
|
||
/// <inheritdoc cref="_testIn3Property"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn3Property { get => _testIn3Property = _testIn3PropertyHelper?.Value ?? _testIn3Property; } | ||
|
||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
protected void InitializeOAPH() | ||
{ | ||
_testIn3PropertyHelper = TestIn3!.ToProperty(this, nameof(TestIn3Property)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
37 changes: 37 additions & 0 deletions
37
...NestedClasses#TestNs.TestVM+TestVMInner2.ObservableAsPropertyFromObservable.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//HintName: TestNs.TestVM+TestVMInner2.ObservableAsPropertyFromObservable.g.cs | ||
// <auto-generated/> | ||
using ReactiveUI; | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
|
||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner2 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner2 | ||
{ | ||
/// <inheritdoc cref="TestIn2Property"/> | ||
private int _testIn2Property; | ||
|
||
/// <inheritdoc cref="_testIn2PropertyHelper"/> | ||
private ReactiveUI.ObservableAsPropertyHelper<int>? _testIn2PropertyHelper; | ||
|
||
/// <inheritdoc cref="_testIn2Property"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn2Property { get => _testIn2Property = _testIn2PropertyHelper?.Value ?? _testIn2Property; } | ||
|
||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
protected void InitializeOAPH() | ||
{ | ||
_testIn2PropertyHelper = TestIn2!.ToProperty(this, nameof(TestIn2Property)); | ||
} | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
33 changes: 33 additions & 0 deletions
33
...bservablePropNestedClasses#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs | ||
// <auto-generated/> | ||
using ReactiveUI; | ||
|
||
#pragma warning disable | ||
#nullable enable | ||
|
||
namespace TestNs | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVM which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVM | ||
{ | ||
/// <inheritdoc cref="Test1Property"/> | ||
private int _test1Property; | ||
|
||
/// <inheritdoc cref="_test1PropertyHelper"/> | ||
private ReactiveUI.ObservableAsPropertyHelper<int>? _test1PropertyHelper; | ||
|
||
/// <inheritdoc cref="_test1Property"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int Test1Property { get => _test1Property = _test1PropertyHelper?.Value ?? _test1Property; } | ||
|
||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
protected void InitializeOAPH() | ||
{ | ||
_test1PropertyHelper = Test1!.ToProperty(this, nameof(Test1Property)); | ||
} | ||
} | ||
} | ||
#nullable restore | ||
#pragma warning restore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...mFieldNestedClass#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//HintName: ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.cs | ||
// Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace ReactiveUI.SourceGenerators; | ||
|
||
/// <summary> | ||
/// ObservableAsPropertyAttribute. | ||
/// </summary> | ||
/// <seealso cref="Attribute" /> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
internal sealed class ObservableAsPropertyAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Gets the name of the property. | ||
/// </summary> | ||
/// <value> | ||
/// The name of the property. | ||
/// </value> | ||
public string? PropertyName { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the Readonly state of the OAPH property. | ||
/// </summary> | ||
/// <value> | ||
/// The is read only of the OAPH property. | ||
/// </value> | ||
public bool ReadOnly { get; init; } = true; | ||
} | ||
#nullable restore | ||
#pragma warning restore |
25 changes: 25 additions & 0 deletions
25
...ests.FromFieldNestedClass#TestNs.TestVM+TestVMInner1.ObservableAsProperties.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//HintName: TestNs.TestVM+TestVMInner1.ObservableAsProperties.g.cs | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner1 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner1 | ||
{ | ||
/// <inheritdoc cref="_testIn1Helper"/> | ||
private readonly ReactiveUI.ObservableAsPropertyHelper<int> _testIn1Helper; | ||
|
||
/// <inheritdoc cref="_testIn1"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn1 { get => _testIn1 = _testIn1Helper?.Value ?? _testIn1; } | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
28 changes: 28 additions & 0 deletions
28
...dNestedClass#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsProperties.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//HintName: TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsProperties.g.cs | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
public partial class TestVMInner2 | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner3 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner3 | ||
{ | ||
/// <inheritdoc cref="_testIn3Helper"/> | ||
private readonly ReactiveUI.ObservableAsPropertyHelper<int> _testIn3Helper; | ||
|
||
/// <inheritdoc cref="_testIn3"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn3 { get => _testIn3 = _testIn3Helper?.Value ?? _testIn3; } | ||
} | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
25 changes: 25 additions & 0 deletions
25
...ests.FromFieldNestedClass#TestNs.TestVM+TestVMInner2.ObservableAsProperties.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//HintName: TestNs.TestVM+TestVMInner2.ObservableAsProperties.g.cs | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace TestNs | ||
{ | ||
public partial class TestVM | ||
{ | ||
/// <summary> | ||
/// Partial class for the TestVMInner2 which contains ReactiveUI Observable As Property initialization. | ||
/// </summary> | ||
public partial class TestVMInner2 | ||
{ | ||
/// <inheritdoc cref="_testIn2Helper"/> | ||
private readonly ReactiveUI.ObservableAsPropertyHelper<int> _testIn2Helper; | ||
|
||
/// <inheritdoc cref="_testIn2"/> | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public int TestIn2 { get => _testIn2 = _testIn2Helper?.Value ?? _testIn2; } | ||
} | ||
} | ||
|
||
} | ||
#nullable restore | ||
#pragma warning restore |
Oops, something went wrong.