Commit c9f86ebb authored by Victor Manuel Jaquez Leal's avatar Victor Manuel Jaquez Leal Committed by Jürg Billeter

vapigen: Support type_id attribute for classes

Fixes bug 615633.
Signed-off-by: Victor Manuel Jaquez Leal's avatarVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
parent a722c9be
......@@ -677,15 +677,19 @@ public class Vala.Class : ObjectTypeSymbol {
}
}
public string? get_default_type_id () {
if (is_compact) {
return "G_TYPE_POINTER";
}
return get_upper_case_cname ("TYPE_");
}
public override string? get_type_id () {
if (type_id == null) {
if (!is_compact) {
type_id = get_upper_case_cname ("TYPE_");
} else {
type_id = "G_TYPE_POINTER";
}
type_id = get_default_type_id ();
}
return type_id;
}
......
......@@ -215,7 +215,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_string ("type_check_function = \"%s\", ".printf (cl.type_check_function ));
}
if (cl.is_compact && cl.get_type_id () != "G_TYPE_POINTER") {
if (cl.get_type_id () != cl.get_default_type_id ()) {
write_string ("type_id = \"%s\", ".printf (cl.get_type_id ()));
}
......
......@@ -1066,6 +1066,8 @@ public class Vala.GIdlParser : CodeVisitor {
}
} else if (nv[0] == "type_check_function") {
cl.type_check_function = eval (nv[1]);
} else if (nv[0] == "type_id") {
cl.set_type_id (eval (nv[1]));
} else if (nv[0] == "abstract") {
if (eval (nv[1]) == "1") {
cl.is_abstract = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment