Skip to content

Commit f0719db

Browse files
xClassModifier (#31754)
1 parent f6b51c1 commit f0719db

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SetPropertiesVisitor(ILContext context, bool stopOnResourceDictionary = fa
1818
public static readonly IList<XmlName> skips = [
1919
XmlName.xArguments,
2020
XmlName.xClass,
21+
XmlName.xClassModifier,
2122
XmlName.xDataType,
2223
XmlName.xFactoryMethod,
2324
XmlName.xFieldModifier,

src/Controls/src/SourceGen/Visitors/SetPropertiesVisitor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class SetPropertiesVisitor(SourceGenContext context, bool stopOnResourceDictiona
2222
public static readonly IList<XmlName> skips = [
2323
XmlName.xArguments,
2424
XmlName.xClass,
25+
XmlName.xClassModifier,
2526
XmlName.xDataType,
2627
XmlName.xFactoryMethod,
2728
XmlName.xFieldModifier,

src/Controls/src/Xaml/ApplyPropertiesVisitor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ApplyPropertiesVisitor : IXamlNodeVisitor
2424
public static readonly IList<XmlName> Skips = [
2525
XmlName.xArguments,
2626
XmlName.xClass,
27+
XmlName.xClassModifier,
2728
XmlName.xDataType,
2829
XmlName.xFactoryMethod,
2930
XmlName.xFieldModifier,

src/Controls/src/Xaml/XamlParser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ public static XmlName ParsePropertyName(XmlName name)
283283
return XmlName.xFactoryMethod;
284284
case "Arguments":
285285
return XmlName.xArguments;
286+
case "ClassModifier":
287+
return XmlName.xClassModifier;
286288
default:
287289
Debug.WriteLine("Unhandled attribute {0}", name);
288290
return XmlName.Empty;

src/Controls/tests/SourceGen.UnitTests/InitializeComponent/BasicCase.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public void BasicXaml()
1414
<ContentPage
1515
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
1616
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
17-
x:Class="Test.TestPage">
17+
x:Class="Test.TestPage"
18+
x:ClassModifier="Internal">
1819
<Button x:Name="MyButton" Text="Hello MAUI!" />
1920
</ContentPage>
2021
""";
@@ -28,7 +29,7 @@ public void BasicXaml()
2829
namespace Test;
2930
3031
[XamlProcessing(XamlInflator.SourceGen)]
31-
public partial class TestPage : ContentPage
32+
partial class TestPage : ContentPage
3233
{
3334
public TestPage()
3435
{
@@ -53,12 +54,12 @@ public TestPage()
5354
namespace Test;
5455
5556
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Maui.Controls.SourceGen, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null", "10.0.0.0")]
56-
public partial class TestPage
57+
internal partial class TestPage
5758
{
5859
private partial void InitializeComponent()
5960
{
6061
var button = new global::Microsoft.Maui.Controls.Button();
61-
global::Microsoft.Maui.VisualDiagnostics.RegisterSourceInfo(button!, new global::System.Uri(@"Test.xaml;assembly=SourceGeneratorDriver.Generated", global::System.UriKind.Relative), 6, 4);
62+
global::Microsoft.Maui.VisualDiagnostics.RegisterSourceInfo(button!, new global::System.Uri(@"Test.xaml;assembly=SourceGeneratorDriver.Generated", global::System.UriKind.Relative), 7, 4);
6263
var __root = this;
6364
global::Microsoft.Maui.VisualDiagnostics.RegisterSourceInfo(__root!, new global::System.Uri(@"Test.xaml;assembly=SourceGeneratorDriver.Generated", global::System.UriKind.Relative), 2, 2);
6465
#if !_MAUIXAML_SG_NAMESCOPE_DISABLE
@@ -87,4 +88,4 @@ private partial void InitializeComponent()
8788

8889
Assert.AreEqual(expected, generated);
8990
}
90-
}
91+
}

0 commit comments

Comments
 (0)