summaryrefslogtreecommitdiff
path: root/vala/valagirparser.vala
diff options
context:
space:
mode:
Diffstat (limited to 'vala/valagirparser.vala')
-rw-r--r--vala/valagirparser.vala12
1 files changed, 12 insertions, 0 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 6b3d69357..88f38434b 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1535,6 +1535,18 @@ public class Vala.GirParser : CodeVisitor {
const string GIR_VERSION = "1.2";
static void add_symbol_to_container (Symbol container, Symbol sym) {
+ if (sym.name == "") {
+ Report.warning (sym.source_reference, "node with empty name");
+ return;
+ } else if (sym.name != null) {
+ Symbol? old_sym = container.scope.lookup (sym.name);
+ if (old_sym != null) {
+ Report.warning (sym.source_reference, "`%s' already contains a definition for `%s'", container.name, sym.name);
+ Report.notice (old_sym.source_reference, "previous definition of `%s' was here", old_sym.name);
+ return;
+ }
+ }
+
if (container is Class) {
unowned Class cl = (Class) container;