]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vapigen: Don't emit ".@new" on default constructor
authorRyan Lortie <desrt@desrt.ca>
Sat, 17 Oct 2009 15:14:13 +0000 (11:14 -0400)
committerRyan Lortie <desrt@desrt.ca>
Sat, 17 Oct 2009 15:15:35 +0000 (11:15 -0400)
Special-case a constructor name of "new" appearing in a .gir file to be
the default constructor.

vapigen/valagirparser.vala

index b733839eb5c4599931e89a5f7520667bff897fbb..49ad98f85015e9f84afebc6986a90f0f818334ec 100644 (file)
@@ -823,7 +823,9 @@ public class Vala.GirParser : CodeVisitor {
                if (ctype != null && (parent_ctype == null || ctype != parent_ctype + "*")) {
                        m.custom_return_type_cname = ctype;
                }
-               if (m.name.has_prefix ("new_")) {
+               if (m.name == "new") {
+                       m.name = null;
+               } else if (m.name.has_prefix ("new_")) {
                        m.name = m.name.offset ("new_".len ());
                }
                if (current_token == MarkupTokenType.START_ELEMENT && reader.name == "parameters") {