]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
support main function in root namespace, fixes bug 516950
authorJuerg Billeter <j@bitron.ch>
Sun, 24 Feb 2008 15:49:11 +0000 (15:49 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 24 Feb 2008 15:49:11 +0000 (15:49 +0000)
2008-02-24  Juerg Billeter  <j@bitron.ch>

* vala/valamethod.vala: support main function in root namespace,
  fixes bug 516950

svn path=/trunk/; revision=1051

ChangeLog
vala/valamethod.vala

index eb8b6f605d10a3a37c6a795952b3bf52dabe2be4..464971994eefe558651708c8b7d3a4a051003a76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-24  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valamethod.vala: support main function in root namespace,
+         fixes bug 516950
+
 2008-02-24  Jürg Billeter  <j@bitron.ch>
 
        * vala/valasemanticanalyzer.vala, gobject/valaccodegenerator.vala:
index 299e78ebeb528d2c31f176976adece99651379c9..ef43e1ad040659494367ca7a0f58fb1688715930 100644 (file)
@@ -296,7 +296,10 @@ public class Vala.Method : Member {
         * @return the name to be used in C code by default
         */
        public virtual string! get_default_cname () {
-               if (name.has_prefix ("_")) {
+               if (name == "main" && parent_symbol.name == null) {
+                       // avoid conflict with generated main function
+                       return "_main";
+               } else if (name.has_prefix ("_")) {
                        return "_%s%s".printf (parent_symbol.get_lower_case_cprefix (), name.offset (1));
                } else {
                        return "%s%s".printf (parent_symbol.get_lower_case_cprefix (), name);