glsl: Remove name_declared_this_scope check when adding functions.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 25 Aug 2010 23:37:46 +0000 (16:37 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 26 Aug 2010 16:19:48 +0000 (09:19 -0700)
Instead, rely on the symbol table's rules.

Fixes redeclaration-02.vert.

src/glsl/ast_to_hir.cpp

index 8c105e79f71adc55832d8375477477627f448cb4..8caf950c2d2b49a971e71acb951312d72462b6d7 100644 (file)
@@ -2197,17 +2197,16 @@ ast_function::hir(exec_list *instructions,
            _mesa_glsl_error(& loc, state, "function `%s' redefined", name);
         }
       }
-   } else if (state->symbols->name_declared_this_scope(name)) {
-      /* This function name shadows a non-function use of the same name.
-       */
-      YYLTYPE loc = this->get_location();
-
-      _mesa_glsl_error(& loc, state, "function name `%s' conflicts with "
-                      "non-function", name);
-      return NULL;
    } else {
       f = new(ctx) ir_function(name);
-      state->symbols->add_function(f->name, f);
+      if (!state->symbols->add_function(f->name, f)) {
+        /* This function name shadows a non-function use of the same name. */
+        YYLTYPE loc = this->get_location();
+
+        _mesa_glsl_error(&loc, state, "function name `%s' conflicts with "
+                         "non-function", name);
+        return NULL;
+      }
 
       /* Emit the new function header */
       instructions->push_tail(f);