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
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:
fix crash when using delegates as properties, fixes bug 517499
* @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);