fix(codegen): Fixes list rules (#632)

This commit is contained in:
Kamron Batman 2021-06-01 16:41:43 -07:00 committed by GitHub
parent 8b0bdc7d62
commit 72d3966541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -80,7 +80,7 @@ namespace SerializableMigration
var propertyCount = $"{propertyVarPrefix}Count";
source.AppendLine($"{indent}{ruleArguments[0]} {propertyEntry};");
source.AppendLine($"{indent}var {propertyCount} = reader.ReadEncodedInt();");
source.AppendLine($"{indent}var {propertyCount} = reader.ReadInt();");
source.AppendLine($"{indent}{property.Name} = new System.Collections.Generic.HashSet<{ruleArguments[0]}>({propertyCount});");
source.AppendLine($"{indent}for (var {propertyIndex} = 0; i < {propertyCount}; {propertyIndex}++)");
source.AppendLine($"{indent}{{");
@ -116,7 +116,7 @@ namespace SerializableMigration
var propertyName = property.Name;
var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}";
var propertyEntry = $"{propertyVarPrefix}Entry";
source.AppendLine($"{indent}writer.WriteEncodedInt({property.Name}.Count);");
source.AppendLine($"{indent}writer.Write({property.Name}.Count);");
source.AppendLine($"{indent}foreach (var {propertyEntry} in {property.Name});");
source.AppendLine($"{indent}{{");