Prepare code generator for 1.75 default enum arguments.

internals
Eric Mellino 5 years ago
parent 35aabdc9b8
commit 1dfd06d6b4
  1. 9
      src/CodeGenerator/Program.cs

@ -962,6 +962,12 @@ namespace CodeGenerator
if (defaultVal.Contains("%")) { correctedDefault = null; return false; } if (defaultVal.Contains("%")) { correctedDefault = null; return false; }
if (tr.IsEnum)
{
correctedDefault = $"({tr.Type}){defaultVal}";
return true;
}
correctedDefault = defaultVal; correctedDefault = defaultVal;
return true; return true;
} }
@ -1120,6 +1126,7 @@ namespace CodeGenerator
public int ArraySize { get; } public int ArraySize { get; }
public bool IsFunctionPointer { get; } public bool IsFunctionPointer { get; }
public string[] TypeVariants { get; } public string[] TypeVariants { get; }
public bool IsEnum { get; }
public TypeReference(string name, string type, EnumDefinition[] enums) public TypeReference(string name, string type, EnumDefinition[] enums)
: this(name, type, null, enums, null) { } : this(name, type, null, enums, null) { }
@ -1161,6 +1168,8 @@ namespace CodeGenerator
IsFunctionPointer = Type.IndexOf('(') != -1; IsFunctionPointer = Type.IndexOf('(') != -1;
TypeVariants = typeVariants; TypeVariants = typeVariants;
IsEnum = enums.Any(t => t.Name == type || t.FriendlyName == type);
} }
private int ParseSizeString(string sizePart, EnumDefinition[] enums) private int ParseSizeString(string sizePart, EnumDefinition[] enums)

Loading…
Cancel
Save