Skip to content

Commit

Permalink
Syncing content from committish e178b293fdc00384f14895e83fedc3ac868bf61e
Browse files Browse the repository at this point in the history
  • Loading branch information
reunion-maestro-bot committed Nov 12, 2024
1 parent 6471fbe commit 63671e0
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 93 deletions.
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK</Uri>
<Sha>f51f55b53b094d28a8fb117fe79fa354a3287c3b</Sha>
</Dependency>
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.5.4-CI-26105.1010.240927-1621.0">
<Dependency Name="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.5.4-CI-26105.1011.241025-1113.31">
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
<Sha>943a920dac1612ac395a09f42af287a08e6eddac</Sha>
<Sha>26df64c7fa2693f44c179a7ba4c9df3257b76865</Sha>
</Dependency>
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.5.4-CI-26105.1010.240927-1621.0">
<Dependency Name="Microsoft.Internal.InteractiveExperiences" Version="1.5.4-CI-26105.1011.241025-1113.31">
<Uri>https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP</Uri>
<Sha>943a920dac1612ac395a09f42af287a08e6eddac</Sha>
<Sha>26df64c7fa2693f44c179a7ba4c9df3257b76865</Sha>
</Dependency>
<!-- Microsoft-WinUI-SDK repo (MSBuild and Visual Studio extensions for building, deploying, and debugging packaged applications.) -->
<Dependency Name="Microsoft.Build.Msix" Version="1.5.0-zmain.240510.2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ private void Output_GetBindingConnectorCase(ConnectionIdElement element, bool is
}
private void Output_GetBindingConnectorMethod()
{
this.Write(" /// <summary>\r\n /// GetBindingConnector(int connectionId, object t" +
"arget)\r\n /// </summary>\r\n ");
this.Write("\r\n /// <summary>\r\n /// GetBindingConnector(int connectionId, object" +
" target)\r\n /// </summary>\r\n ");

this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedCodeAttribute));

Expand Down Expand Up @@ -1098,41 +1098,8 @@ private void Output_BindingsClasses()
foreach (BoundEventAssignment evt in element.BoundEventAssignments)
{
Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs);
this.Write(" this.");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.EventHandlerCodeName));

this.Write(" = (");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));

this.Write(") =>\r\n {\r\n");

PushIndent();
if (!evt.PathStep.ValueType.IsDelegate())
{
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write(";\r\n");

}
else
{
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write("(");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));

this.Write(");\r\n");

}
PopIndent();
this.Write(" };\r\n (");
Output_NullCheckedEventAssignment(evt);
this.Write(" (");

this.Write(this.ToStringHelper.ToStringWithCulture(ObjectCast(element.Type.ToString(), "target")));

Expand Down Expand Up @@ -2744,6 +2711,54 @@ void Output_NullCheckedAssignment(BindPathStep step, LanguageSpecificString val
}
PopIndent();
}
void Output_NullCheckedEventAssignment(BoundEventAssignment evt)
{
this.Write(" this.");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.EventHandlerCodeName));

this.Write(" = (");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));

this.Write(") =>\r\n {\r\n");

foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
this.Write(" if (");

this.Write(this.ToStringHelper.ToStringWithCulture(parent.CodeGen().PathExpression));

this.Write(" != null)\r\n {\r\n");

PushIndent();
}
if (!evt.PathStep.ValueType.IsDelegate()) {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write(";\r\n");

} else {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write("(");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));

this.Write(");\r\n");

}
foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
PopIndent();
this.Write(" }\r\n");

}
this.Write(" };\r\n");

}
void Output_UpdateErrors(BindUniverse bindUniverse)
{
var twoWayWithIndeiSteps = bindUniverse.INDEIPathSteps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>

<#+ private void Output_GetBindingConnectorMethod()#>
<#+ {#>

/// <summary>
/// GetBindingConnector(int connectionId, object target)
/// </summary>
Expand Down Expand Up @@ -561,19 +562,7 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
<#+ foreach (BoundEventAssignment evt in element.BoundEventAssignments)#>
<#+ {#>
<#+ Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs); #>
this.<#=evt.EventHandlerCodeName#> = (<#=evt.Parameters.Declaration()#>) =>
{
<#+ PushIndent();#>
<#+ if (!evt.PathStep.ValueType.IsDelegate())#>
<#+ {#>
<#=evt.PathStep.CodeGen().PathExpression#>;
<#+ }#>
<#+ else#>
<#+ {#>
<#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
<#+ }#>
<#+ PopIndent();#>
};
<#+ Output_NullCheckedEventAssignment(evt); #>
(<#=ObjectCast(element.Type.ToString(), "target")#>).<#=evt.MemberName#> += <#=evt.EventHandlerCodeName#>;
<#+ Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs); #>
<#+ }#>
Expand Down Expand Up @@ -1473,6 +1462,27 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
<#+ PopIndent();#>
<#+ } #>

<#+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt) #>
<#+ { #>
this.<#=evt.EventHandlerCodeName#> = (<#=evt.Parameters.Declaration()#>) =>
{
<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
if (<#=parent.CodeGen().PathExpression#> != null)
{
<#+ PushIndent(); #>
<#+ } #>
<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
<#=evt.PathStep.CodeGen().PathExpression#>;
<#+ } else { #>
<#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
<#+ } #>
<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
<#+ PopIndent(); #>
}
<#+ } #>
};
<#+ } #>

<#+ void Output_UpdateErrors(BindUniverse bindUniverse) #>
<#+ { #>
<#+ var twoWayWithIndeiSteps = bindUniverse.INDEIPathSteps; #>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,37 +633,7 @@ private void Output_ConnectionId_Case(ConnectionIdElement element)

foreach (BoundEventAssignment evt in element.BoundEventAssignments) {
Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs);
this.Write(" targetElement.");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.MemberName));

this.Write("([this](");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));

this.Write(")\r\n {\r\n");

if (!evt.PathStep.ValueType.IsDelegate()) {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write(";\r\n");

} else {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write("(");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));

this.Write(");\r\n");

}
this.Write(" });\r\n");

Output_NullCheckedEventAssignment(evt);
Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs);
}
if (element.CanBeInstantiatedLater && (element.HasBindAssignments || element.HasBoundEventAssignments))
Expand Down Expand Up @@ -847,6 +817,56 @@ void Output_NullCheckedAssignment(BindPathStep step, LanguageSpecificString val

}
PopIndent();
}
void Output_NullCheckedEventAssignment(BoundEventAssignment evt)
{
this.Write(" targetElement.");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.MemberName));

this.Write("([this](");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));

this.Write(")\r\n {\r\n");

PushIndent(Indent.ThreeTabs);
foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
this.Write(" if (");

this.Write(this.ToStringHelper.ToStringWithCulture(parent.CodeGen().PathExpression));

this.Write(" != nullptr)\r\n {\r\n");

PushIndent();
}
if (!evt.PathStep.ValueType.IsDelegate()) {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write(";\r\n");

} else {
this.Write(" ");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));

this.Write("(");

this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));

this.Write(");\r\n");

}
foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
PopIndent();
this.Write(" }\r\n");

}
PopIndent();
this.Write(" });\r\n");

}
private void Output_UpdateChildListeners_Call(BindPathStep step, string parameter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,7 @@
<#=element.ObjectCodeName#> = targetElement;
<#+ foreach (BoundEventAssignment evt in element.BoundEventAssignments) { #>
<#+ Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs); #>
targetElement.<#=evt.MemberName#>([this](<#=evt.Parameters.Declaration()#>)
{
<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
<#=evt.PathStep.CodeGen().PathExpression#>;
<#+ } else { #>
<#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
<#+ }#>
});
<#+ Output_NullCheckedEventAssignment(evt); #>
<#+ Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs); #>
<#+ }#>
<#+ if (element.CanBeInstantiatedLater && (element.HasBindAssignments || element.HasBoundEventAssignments))#>
Expand Down Expand Up @@ -638,6 +631,29 @@
<#+ PopIndent();#>
<#+ } #>

<#+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt) #>
<#+ { #>
targetElement.<#=evt.MemberName#>([this](<#=evt.Parameters.Declaration()#>)
{
<#+ PushIndent(Indent.ThreeTabs);#>
<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
if (<#=parent.CodeGen().PathExpression#> != nullptr)
{
<#+ PushIndent(); #>
<#+ } #>
<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
<#=evt.PathStep.CodeGen().PathExpression#>;
<#+ } else { #>
<#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
<#+ }#>
<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
<#+ PopIndent(); #>
}
<#+ } #>
<#+ PopIndent();#>
});
<#+ } #>

<#+ private void Output_UpdateChildListeners_Call(BindPathStep step, string parameter)#>
<#+ {#>
<#+ if (step.NeedsUpdateChildListeners)#>
Expand Down

0 comments on commit 63671e0

Please sign in to comment.