mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-16 11:34:47 +02:00
generator: Added throws attribute to parameters
This enables gapi to decide whether a parameter is really throwing or should be handled as a usual parameter.
This commit is contained in:
parent
94da3fb2ab
commit
8d4ec22ef2
@ -49,6 +49,18 @@ namespace GtkSharp.Generation {
|
|||||||
get { return param_list.Count; }
|
get { return param_list.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gapi assumes GError** parameters to be error parameters in version 1 and 2
|
||||||
|
private bool throws = false;
|
||||||
|
public bool Throws {
|
||||||
|
get {
|
||||||
|
if (ParserVersion <= 2)
|
||||||
|
return true;
|
||||||
|
if (!throws && elem.HasAttribute ("throws"))
|
||||||
|
throws = elem.GetAttributeAsBoolean ("throws");
|
||||||
|
return throws;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int VisibleCount {
|
public int VisibleCount {
|
||||||
get {
|
get {
|
||||||
int visible = 0;
|
int visible = 0;
|
||||||
@ -76,7 +88,7 @@ namespace GtkSharp.Generation {
|
|||||||
if (p.IsCount)
|
if (p.IsCount)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (p.CType == "GError**")
|
if (p.CType == "GError**" && Throws)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (HasCB || HideData) {
|
if (HasCB || HideData) {
|
||||||
@ -212,7 +224,7 @@ namespace GtkSharp.Generation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (p.CType == "GError**")
|
} else if (p.CType == "GError**" && Throws)
|
||||||
p = new ErrorParameter (parm);
|
p = new ErrorParameter (parm);
|
||||||
else if (gen is StructBase || gen is ByRefGen) {
|
else if (gen is StructBase || gen is ByRefGen) {
|
||||||
p = new StructParameter (parm);
|
p = new StructParameter (parm);
|
||||||
@ -277,5 +289,12 @@ namespace GtkSharp.Generation {
|
|||||||
return String.Join (", ", result);
|
return String.Join (", ", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int ParserVersion {
|
||||||
|
get {
|
||||||
|
XmlElement root = elem.OwnerDocument.DocumentElement;
|
||||||
|
return root.HasAttribute ("parser_version") ? int.Parse (root.GetAttribute ("parser_version")) : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user