mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 01:55:30 +00:00
generator: Add a way to force constructors to be names
In some cases (GstEvent) unnamed constructors make no sense
This commit is contained in:
parent
dd8f3f994e
commit
9002cefe44
|
@ -46,6 +46,12 @@ namespace GtkSharp.Generation {
|
|||
private Dictionary<string, Ctor> clash_map;
|
||||
private bool deprecated = false;
|
||||
private bool isabstract = false;
|
||||
public bool nameConstructors {
|
||||
get {
|
||||
return Elem.GetAttributeAsBoolean("name_constructors");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public IDictionary<string, Method> Methods {
|
||||
get {
|
||||
|
@ -563,7 +569,11 @@ namespace GtkSharp.Generation {
|
|||
clash_map = new Dictionary<string, Ctor>();
|
||||
|
||||
foreach (Ctor ctor in ctors) {
|
||||
if (clash_map.ContainsKey (ctor.Signature.Types)) {
|
||||
if (nameConstructors) {
|
||||
ctor.IsStatic = true;
|
||||
if (Parent != null && Parent.HasStaticCtor (ctor.StaticName))
|
||||
ctor.Modifiers = "new ";
|
||||
} else if (clash_map.ContainsKey (ctor.Signature.Types)) {
|
||||
Ctor clash = clash_map [ctor.Signature.Types];
|
||||
Ctor alter = ctor.Preferred ? clash : ctor;
|
||||
alter.IsStatic = true;
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace GtkSharp.Generation {
|
|||
preferred = elem.GetAttributeAsBoolean ("preferred");
|
||||
if (implementor is ObjectGen)
|
||||
needs_chaining = true;
|
||||
|
||||
name = implementor.Name;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue