ERRORDOMAIN,
DESTROYS_INSTANCE,
BASE_TYPE,
- FINISH_NAME;
+ FINISH_NAME,
+ SYMBOL_TYPE,
+ INSTANCE_IDX;
public static ArgumentType? from_string (string name) {
var enum_class = (EnumClass) typeof(ArgumentType).class_ref ();
start_element (element_name);
push_node (element_get_name (reader.get_attribute ("invoker")).replace ("-", "_"), false);
+ string symbol_type;
+ if (metadata.has_argument (ArgumentType.SYMBOL_TYPE)) {
+ symbol_type = metadata.get_string (ArgumentType.SYMBOL_TYPE);
+ } else {
+ symbol_type = element_name;
+ }
+
string name = current.name;
string throws_string = reader.get_attribute ("throws");
string invoker = reader.get_attribute ("invoker");
Symbol s;
- if (element_name == "callback") {
+ if (symbol_type == "callback") {
s = new Delegate (name, return_type, current.source_reference);
((Delegate) s).has_target = false;
- } else if (element_name == "constructor") {
+ } else if (symbol_type == "constructor") {
if (name == "new") {
name = null;
} else if (name.has_prefix ("new_")) {
m.set_attribute_string ("CCode", "type", return_ctype);
}
s = m;
- } else if (element_name == "glib:signal") {
+ } else if (symbol_type == "glib:signal") {
s = new Signal (name, return_type, current.source_reference);
} else {
s = new Method (name, return_type, current.source_reference);
if (s is Method) {
var m = (Method) s;
- if (element_name == "virtual-method" || element_name == "callback") {
+ if (symbol_type == "virtual-method" || symbol_type == "callback") {
if (current.parent.symbol is Interface) {
m.is_abstract = true;
} else {
} if (current.girdata["name"] != name) {
m.set_attribute_string ("CCode", "vfunc_name", current.girdata["name"]);
}
- } else if (element_name == "function") {
+ } else if (symbol_type == "function") {
m.binding = MemberBinding.STATIC;
}
}
}
}
+ if (element_name == "function" && symbol_type == "method") {
+ if (metadata.has_argument (ArgumentType.INSTANCE_IDX)) {
+ int instance_pos = metadata.get_integer (ArgumentType.INSTANCE_IDX);
+ s.set_attribute_double ("CCode", "instance_pos", instance_pos + 0.5);
+ parameters.remove_at (instance_pos);
+ } else {
+ Report.error (get_current_src (), "instance_idx required when converting function to method");
+ }
+ }
+
pop_node ();
end_element (element_name);
}