Allow duplicate symbols at the same scope that are in different name spaces
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 24 Mar 2010 21:56:36 +0000 (14:56 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 24 Mar 2010 21:56:36 +0000 (14:56 -0700)
symbol_table.c

index 5d748f45c7cf1945dcd91c74fc73174edc2e8a65..0f0df7a261b8225dd6c4c47e37262b6889f5dfb1 100644 (file)
@@ -347,10 +347,16 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
 
     check_symbol_table(table);
 
-    /* If the symbol already exists at this scope, it cannot be added to the
-     * table.
+    /* If the symbol already exists in this namespace at this scope, it cannot
+     * be added to the table.
      */
-    if (hdr->symbols && (hdr->symbols->depth == table->depth))
+    for (sym = hdr->symbols
+           ; (sym != NULL) && (sym->name_space != name_space)
+           ; sym = sym->next_with_same_name) {
+       /* empty */
+    }
+
+    if (sym && (sym->depth == table->depth))
        return -1;
 
     sym = calloc(1, sizeof(*sym));