]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix error message on duplicate definition in root namespace
authorJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 19:10:16 +0000 (20:10 +0100)
committerJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 19:10:16 +0000 (20:10 +0100)
Fixes bug 601349.

vala/valascope.vala

index 046546123ffd293ed5e89ede2656b28fb0b130dc..afab10aa4c6904f05d935f2d48e202e0d8279902 100644 (file)
@@ -1,6 +1,6 @@
 /* valascope.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -61,7 +61,11 @@ public class Vala.Scope {
                                symbol_table = new HashMap<string,Symbol> (str_hash, str_equal);
                        } else if (lookup (name) != null) {
                                owner.error = true;
-                               Report.error (sym.source_reference, "`%s' already contains a definition for `%s'".printf (owner.get_full_name (), name));
+                               if (owner.name == null && owner.parent_symbol == null) {
+                                       Report.error (sym.source_reference, "The root namespace already contains a definition for `%s'".printf (name));
+                               } else {
+                                       Report.error (sym.source_reference, "`%s' already contains a definition for `%s'".printf (owner.get_full_name (), name));
+                               }
                                return;
                        }