fix(codegen): Fixes codegen on VS2019 (#629)
- [X] Fixes code gen on VS2019 - [X] Fixes schema generator not iterating through all nodes - [X] Fixes errors with building the actual code gen
This commit is contained in:
parent
b6779a7c09
commit
ac3958a0b8
13 changed files with 198 additions and 45 deletions
|
|
@ -70,7 +70,7 @@ namespace SerializableMigration
|
|||
Array.Copy(ruleArguments, 2, arrayElementRuleArguments, 0, ruleArguments.Length - 2);
|
||||
|
||||
var propertyIndex = $"{property.Name}Index";
|
||||
source.AppendLine($"{indent}{property.Name} = new {ruleArguments[0]}[reader.ReadInt()];");
|
||||
source.AppendLine($"{indent}{property.Name} = new {ruleArguments[0]}[reader.ReadEncodedInt()];");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {property.Name}.Length; {propertyIndex}++)");
|
||||
source.AppendLine($"{indent}{{");
|
||||
|
||||
|
|
@ -101,11 +101,9 @@ namespace SerializableMigration
|
|||
var arrayElementRuleArguments = new string[ruleArguments.Length - 2];
|
||||
Array.Copy(ruleArguments, 2, arrayElementRuleArguments, 0, ruleArguments.Length - 2);
|
||||
|
||||
var propertyName = property.Name;
|
||||
var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}";
|
||||
var propertyIndex = $"{propertyVarPrefix}Index";
|
||||
source.AppendLine($"{indent}writer.Write({property.Name}.Length);");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {propertyVarPrefix}.Length; {propertyIndex}++)");
|
||||
var propertyIndex = $"{property.Name}Index";
|
||||
source.AppendLine($"{indent}writer.WriteEncodedInt({property.Name}.Length);");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {property.Name}.Length; {propertyIndex}++)");
|
||||
source.AppendLine($"{indent}{{");
|
||||
|
||||
var serializableArrayElement = new SerializableProperty
|
||||
|
|
|
|||
|
|
@ -77,10 +77,12 @@ namespace SerializableMigration
|
|||
var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}";
|
||||
var propertyIndex = $"{propertyVarPrefix}Index";
|
||||
var propertyEntry = $"{propertyVarPrefix}Entry";
|
||||
var propertyCount = $"{propertyVarPrefix}Count";
|
||||
|
||||
source.AppendLine($"{indent}{ruleArguments[0]} {propertyEntry};");
|
||||
source.AppendLine($"{indent}{propertyName} = new System.Collections.Generic.HashSet<{ruleArguments[0]}>(reader.ReadInt());");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; i < {propertyName}.Count; {propertyIndex}++)");
|
||||
source.AppendLine($"{indent}var {propertyCount} = reader.ReadEncodedInt();");
|
||||
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}{{");
|
||||
|
||||
var serializableSetElement = new SerializableProperty
|
||||
|
|
@ -114,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.Write({property.Name}.Count);");
|
||||
source.AppendLine($"{indent}writer.WriteEncodedInt({property.Name}.Count);");
|
||||
source.AppendLine($"{indent}foreach (var {propertyEntry} in {property.Name});");
|
||||
source.AppendLine($"{indent}{{");
|
||||
|
||||
|
|
|
|||
|
|
@ -77,10 +77,12 @@ namespace SerializableMigration
|
|||
var propertyVarPrefix = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}";
|
||||
var propertyIndex = $"{propertyVarPrefix}Index";
|
||||
var propertyEntry = $"{propertyVarPrefix}Entry";
|
||||
var propertyCount = $"{propertyVarPrefix}Count";
|
||||
|
||||
source.AppendLine($"{indent}{ruleArguments[0]} {propertyEntry};");
|
||||
source.AppendLine($"{indent}{propertyName} = new System.Collections.Generic.List<{ruleArguments[0]}>(reader.ReadInt());");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {propertyName}.Count; {propertyIndex}++)");
|
||||
source.AppendLine($"{indent}var {propertyCount} = reader.ReadEncodedInt();");
|
||||
source.AppendLine($"{indent}{propertyName} = new System.Collections.Generic.List<{ruleArguments[0]}>({propertyCount});");
|
||||
source.AppendLine($"{indent}for (var {propertyIndex} = 0; {propertyIndex} < {propertyCount}; {propertyIndex}++)");
|
||||
source.AppendLine($"{indent}{{");
|
||||
|
||||
var serializableListElement = new SerializableProperty
|
||||
|
|
@ -113,7 +115,7 @@ namespace SerializableMigration
|
|||
|
||||
var propertyName = property.Name;
|
||||
var propertyEntry = $"{char.ToLower(propertyName[0])}{propertyName.Substring(1, propertyName.Length - 1)}Entry";
|
||||
source.AppendLine($"{indent}writer.Write({propertyName}.Count);");
|
||||
source.AppendLine($"{indent}writer.WriteEncodedInt({propertyName}.Count);");
|
||||
source.AppendLine($"{indent}foreach (var {propertyEntry} in {propertyName})");
|
||||
source.AppendLine($"{indent}{{");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue