summaryrefslogtreecommitdiff
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-08-25 16:37:46 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-08-26 09:19:48 -0700
commite09591317b2470fe9c104606577d4e10255727c0 (patch)
treeac45b1503b716dd13dc33079e7daf45d06891261 /src/glsl/ast_to_hir.cpp
parente9c7ceed27f6811ad1cae46c93ce9bc3fb3668d8 (diff)
glsl: Remove name_declared_this_scope check when adding functions.
Instead, rely on the symbol table's rules. Fixes redeclaration-02.vert.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8c105e79f7..8caf950c2d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -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);