mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-09-15 02:47:13 +00:00
Improved handling of enum parameters
When a function parameter matches a strongly-typed enum, the parameter type is explicitly set to that enum. This fixes issues with function parameters referring to enums whose names change after translation.
This commit is contained in:
parent
8d7ba31e0c
commit
9f4eabf8ed
|
@ -215,8 +215,11 @@ namespace Bind
|
||||||
category = enum_processor.TranslateEnumName(category);
|
category = enum_processor.TranslateEnumName(category);
|
||||||
|
|
||||||
// Try to find out if it is an enum. If the type exists in the normal GLEnums list, use this.
|
// Try to find out if it is an enum. If the type exists in the normal GLEnums list, use this.
|
||||||
// Special case for Boolean - it is an enum, but it is dumb to use that instead of the 'bool' type.
|
// Special case for Boolean which is there simply because C89 does not support bool types.
|
||||||
bool normal = enums.TryGetValue(type.CurrentType, out @enum);
|
// We don't really need that in C#
|
||||||
|
bool normal =
|
||||||
|
enums.TryGetValue(type.CurrentType, out @enum) ||
|
||||||
|
enums.TryGetValue(enum_processor.TranslateEnumName(type.CurrentType), out @enum);
|
||||||
|
|
||||||
// Translate enum types
|
// Translate enum types
|
||||||
type.IsEnum = false;
|
type.IsEnum = false;
|
||||||
|
@ -233,7 +236,9 @@ namespace Bind
|
||||||
// Some functions and enums have the same names.
|
// Some functions and enums have the same names.
|
||||||
// Make sure we reference the enums rather than the functions.
|
// Make sure we reference the enums rather than the functions.
|
||||||
if (normal)
|
if (normal)
|
||||||
type.QualifiedType = type.CurrentType.Insert(0, String.Format("{0}.", Settings.EnumsOutput));
|
{
|
||||||
|
type.QualifiedType = String.Format("{0}.{1}", Settings.EnumsOutput, @enum.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Generator.GLTypes.TryGetValue(type.CurrentType, out s))
|
else if (Generator.GLTypes.TryGetValue(type.CurrentType, out s))
|
||||||
|
|
Loading…
Reference in a new issue