Skip to content

Commit

Permalink
Merge pull request #46 from EvoEsports/bugfix/data-context-missing
Browse files Browse the repository at this point in the history
Only use parent component arguments for slot render methods
  • Loading branch information
araszka authored Jan 11, 2024
2 parents 0edf64a + 47114fe commit 6bb21ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/ManiaTemplates/Lib/MtTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ private string CreateSlotRenderMethod(MtComponent component, int scope, MtDataCo
AppendSlotRenderArgumentsToList(methodArguments, parentComponent ?? component);

//add component properties as arguments
AppendComponentPropertiesToMethodArgumentsList(parentComponent ?? component, methodArguments);
if (parentComponent != null)
{
AppendComponentPropertiesToMethodArgumentsList(parentComponent, methodArguments);
}

var output = new StringBuilder(_maniaTemplateLanguage.FeatureBlockStart())
.AppendLine("void " + CreateMethodCall(methodName, string.Join(',', methodArguments), "") + " {");
Expand Down
6 changes: 3 additions & 3 deletions tests/ManiaTemplates.Tests/Lib/expected.tt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ __insertedOneTimeManiaScripts.Add("FWKSFxnFcgdsXVn9dn5IW3isD6T8z+2eK6liK8rPSpU="
</script>
<#+
}
void Render_Slot_3_default(CRoot_ForEachLoop1 __data,Action __slotRenderer_default,int zIndex = 0,double x = 0.0,double y = 0.0,double w = 0.0,double h = 0.0) {
void Render_Slot_3_default(CRoot_ForEachLoop1 __data,Action __slotRenderer_default) {
var numbers = __data.numbers;
var enabled = __data.enabled;
var __index = __data.__index;
Expand All @@ -104,7 +104,7 @@ Render_Component_MtContext5(__data: __data, text: $"{(i)}, {(j)} at index {(__in
__outerIndex7++;
}
}
void Render_Slot_8_default(CRoot __data,Action __slotRenderer_default,int zIndex = 0,double x = 0.0,double y = 0.0,double w = 0.0,double h = 0.0) {
void Render_Slot_8_default(CRoot __data,Action __slotRenderer_default) {
var numbers = __data.numbers;
var enabled = __data.enabled;
#>
Expand All @@ -115,7 +115,7 @@ Render_Component_MtContext6(__data: __data, arg3: (new test()));
</test>
<#+
}
void Render_Slot_4_default(CRoot __data,Action __slotRenderer_default,int zIndex = 0,double x = 0.0,double y = 0.0,double w = 0.0,double h = 0.0) {
void Render_Slot_4_default(CRoot __data,Action __slotRenderer_default) {
var numbers = __data.numbers;
var enabled = __data.enabled;
Render_Component_MtContext2(__data: __data, __slotRenderer_default: () => Render_Slot_8_default(__data: __data, __slotRenderer_default: () => DoNothing()));
Expand Down

0 comments on commit 6bb21ec

Please sign in to comment.