-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codegen): Adjust mvvm toolkit properties discovery
- Loading branch information
1 parent
56889c1
commit e94127f
Showing
16 changed files
with
949 additions
and
8 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
53 changes: 53 additions & 0 deletions
53
...XamlCodeGeneratorTests/Out/WBOP/ObservablePropertyGenerator_TestRepro.MySubViewModel.g.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,53 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace TestRepro | ||
{ | ||
/// <inheritdoc/> | ||
partial class MySubViewModel | ||
{ | ||
/// <inheritdoc cref="_isEnabled"/> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public bool IsEnabled | ||
{ | ||
get => _isEnabled; | ||
set | ||
{ | ||
if (!global::System.Collections.Generic.EqualityComparer<bool>.Default.Equals(_isEnabled, value)) | ||
{ | ||
OnIsEnabledChanging(value); | ||
OnIsEnabledChanging(default, value); | ||
OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.IsEnabled); | ||
_isEnabled = value; | ||
OnIsEnabledChanged(value); | ||
OnIsEnabledChanged(default, value); | ||
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsEnabled); | ||
} | ||
} | ||
} | ||
|
||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> is changing.</summary> | ||
/// <param name="value">The new property value being set.</param> | ||
/// <remarks>This method is invoked right before the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanging(bool value); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> is changing.</summary> | ||
/// <param name="oldValue">The previous property value that is being replaced.</param> | ||
/// <param name="newValue">The new property value being set.</param> | ||
/// <remarks>This method is invoked right before the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanging(bool oldValue, bool newValue); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> just changed.</summary> | ||
/// <param name="value">The new property value that was set.</param> | ||
/// <remarks>This method is invoked right after the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanged(bool value); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> just changed.</summary> | ||
/// <param name="oldValue">The previous property value that was replaced.</param> | ||
/// <param name="newValue">The new property value that was set.</param> | ||
/// <remarks>This method is invoked right after the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanged(bool oldValue, bool newValue); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ts/XamlCodeGeneratorTests/Out/WBOP/ObservablePropertyGenerator_TestRepro.MyViewModel.g.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,53 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace TestRepro | ||
{ | ||
/// <inheritdoc/> | ||
partial class MyViewModel | ||
{ | ||
/// <inheritdoc cref="_isEnabled"/> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
public bool IsEnabled | ||
{ | ||
get => _isEnabled; | ||
set | ||
{ | ||
if (!global::System.Collections.Generic.EqualityComparer<bool>.Default.Equals(_isEnabled, value)) | ||
{ | ||
OnIsEnabledChanging(value); | ||
OnIsEnabledChanging(default, value); | ||
OnPropertyChanging(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangingArgs.IsEnabled); | ||
_isEnabled = value; | ||
OnIsEnabledChanged(value); | ||
OnIsEnabledChanged(default, value); | ||
OnPropertyChanged(global::CommunityToolkit.Mvvm.ComponentModel.__Internals.__KnownINotifyPropertyChangedArgs.IsEnabled); | ||
} | ||
} | ||
} | ||
|
||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> is changing.</summary> | ||
/// <param name="value">The new property value being set.</param> | ||
/// <remarks>This method is invoked right before the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanging(bool value); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> is changing.</summary> | ||
/// <param name="oldValue">The previous property value that is being replaced.</param> | ||
/// <param name="newValue">The new property value being set.</param> | ||
/// <remarks>This method is invoked right before the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanging(bool oldValue, bool newValue); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> just changed.</summary> | ||
/// <param name="value">The new property value that was set.</param> | ||
/// <remarks>This method is invoked right after the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanged(bool value); | ||
/// <summary>Executes the logic for when <see cref="IsEnabled"/> just changed.</summary> | ||
/// <param name="oldValue">The previous property value that was replaced.</param> | ||
/// <param name="newValue">The new property value that was set.</param> | ||
/// <remarks>This method is invoked right after the value of <see cref="IsEnabled"/> is changed.</remarks> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
partial void OnIsEnabledChanged(bool oldValue, bool newValue); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...eneratorTests/Out/WBOP/ObservablePropertyGenerator___KnownINotifyPropertyChangedArgs.g.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,22 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace CommunityToolkit.Mvvm.ComponentModel.__Internals | ||
{ | ||
/// <summary> | ||
/// A helper type providing cached, reusable <see cref="global::System.ComponentModel.PropertyChangedEventArgs"/> instances | ||
/// for all properties generated with <see cref="global::CommunityToolkit.Mvvm.ComponentModel.ObservablePropertyAttribute"/>. | ||
/// </summary> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
[global::System.Diagnostics.DebuggerNonUserCode] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
[global::System.Obsolete("This type is not intended to be used directly by user code")] | ||
internal static class __KnownINotifyPropertyChangedArgs | ||
{ | ||
/// <summary>The cached <see cref="global::System.ComponentModel.PropertyChangedEventArgs"/> instance for all "IsEnabled" generated properties.</summary> | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
[global::System.Obsolete("This field is not intended to be referenced directly by user code")] | ||
public static readonly global::System.ComponentModel.PropertyChangedEventArgs IsEnabled = new global::System.ComponentModel.PropertyChangedEventArgs("IsEnabled"); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...neratorTests/Out/WBOP/ObservablePropertyGenerator___KnownINotifyPropertyChangingArgs.g.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,22 @@ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
#nullable enable | ||
namespace CommunityToolkit.Mvvm.ComponentModel.__Internals | ||
{ | ||
/// <summary> | ||
/// A helper type providing cached, reusable <see cref="global::System.ComponentModel.PropertyChangingEventArgs"/> instances | ||
/// for all properties generated with <see cref="global::CommunityToolkit.Mvvm.ComponentModel.ObservablePropertyAttribute"/>. | ||
/// </summary> | ||
[global::System.CodeDom.Compiler.GeneratedCode("CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator", "8.2.0.0")] | ||
[global::System.Diagnostics.DebuggerNonUserCode] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
[global::System.Obsolete("This type is not intended to be used directly by user code")] | ||
internal static class __KnownINotifyPropertyChangingArgs | ||
{ | ||
/// <summary>The cached <see cref="global::System.ComponentModel.PropertyChangingEventArgs"/> instance for all "IsEnabled" generated properties.</summary> | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
[global::System.Obsolete("This field is not intended to be referenced directly by user code")] | ||
public static readonly global::System.ComponentModel.PropertyChangingEventArgs IsEnabled = new global::System.ComponentModel.PropertyChangingEventArgs("IsEnabled"); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...nerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_GlobalStaticResources.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,55 @@ | ||
// <autogenerated /> | ||
namespace MyProject | ||
{ | ||
/// <summary> | ||
/// Contains all the static resources defined for the application | ||
/// </summary> | ||
public sealed partial class GlobalStaticResources | ||
{ | ||
static bool _initialized; | ||
private static bool _stylesRegistered; | ||
private static bool _dictionariesRegistered; | ||
internal static global::Uno.UI.Xaml.XamlParseContext __ParseContext_ { get; } = new global::Uno.UI.Xaml.XamlParseContext() | ||
{ | ||
AssemblyName = "TestProject", | ||
} | ||
; | ||
|
||
static GlobalStaticResources() | ||
{ | ||
Initialize(); | ||
} | ||
public static void Initialize() | ||
{ | ||
if (!_initialized) | ||
{ | ||
_initialized = true; | ||
global::Uno.UI.GlobalStaticResources.Initialize(); | ||
global::Uno.UI.GlobalStaticResources.RegisterDefaultStyles(); | ||
global::Uno.UI.GlobalStaticResources.RegisterResourceDictionariesBySource(); | ||
} | ||
} | ||
public static void RegisterDefaultStyles() | ||
{ | ||
if(!_stylesRegistered) | ||
{ | ||
_stylesRegistered = true; | ||
RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); | ||
} | ||
} | ||
// Register ResourceDictionaries using ms-appx:/// syntax, this is called for external resources | ||
public static void RegisterResourceDictionariesBySource() | ||
{ | ||
if(!_dictionariesRegistered) | ||
{ | ||
_dictionariesRegistered = true; | ||
} | ||
} | ||
// Register ResourceDictionaries using ms-resource:/// syntax, this is called for local resources | ||
internal static void RegisterResourceDictionariesBySourceLocal() | ||
{ | ||
} | ||
static partial void RegisterDefaultStyles_MainPage_d6cd66944958ced0c513e0a04797b51d(); | ||
|
||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...nerators.Tests/XamlCodeGeneratorTests/Out/WBOP/XamlCodeGenerator_LocalizationResources.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,2 @@ | ||
// <auto-generated /> | ||
[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")] |
Oops, something went wrong.