Skip to content

Commit

Permalink
- Forgot to replace .Any() with .Count > 0 when changing from IEnumer…
Browse files Browse the repository at this point in the history
…able to IReadOnlyList

 - Collection item names used the variable name instead of the collection name, breaking backwards compatibility.
  • Loading branch information
malware-dev committed Aug 4, 2024
1 parent f2ded0d commit a416406
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/OnyxTemplate/DocumentModel/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void ScanThisScope(TemplateTypeDescriptor.Builder descriptor, IReadOnlyLi
if (n <= 1)
return;

var complexTypeName = Identifier.MakeSafe(loop.Variable + "Item");
var complexTypeName = Identifier.MakeSafe(loop.Collection.Name + "Item");
var complexType = new TemplateTypeDescriptor.Builder(descriptor)
.WithName(complexTypeName);
ScanThisScope(complexType, loop.Blocks);
Expand Down
2 changes: 1 addition & 1 deletion Source/OnyxTemplate/DocumentWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ string resolveField(DocumentFieldReference fieldRef)
fieldReference = $"{fieldReference} != null";
break;
case TemplateFieldType.Collection:
fieldReference = $"({fieldReference} != null && {fieldReference}.Any())";
fieldReference = $"({fieldReference} != null && {fieldReference}.Count > 0)";
break;
default:
throw new ArgumentOutOfRangeException();
Expand Down
2 changes: 1 addition & 1 deletion Source/OnyxTemplate/PackageVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1-alpha
1.3.2-alpha
6 changes: 5 additions & 1 deletion Source/OnyxTemplate/ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v.1.3.1-alpha
v.1.3.2-alpha
- Forgot to replace .Any() with .Count > 0 when changing from IEnumerable to IReadOnlyList
- Collection item names used the variable name instead of the collection name, breaking backwards compatibility.

v.1.3.1-alpha
- I stupidly had implicit usings in my test project, which meant that code that shouldn't have compiled, compiled. Fixed that.

v.1.3.0-alpha
Expand Down

0 comments on commit a416406

Please sign in to comment.