glsl: Refactor variable declaration handling.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Aug 2010 08:45:49 +0000 (01:45 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 26 Aug 2010 16:19:48 +0000 (09:19 -0700)
commit5d25746640ee27882b69a962459727cf924443db
tree8cd6360b5e834d16426b143ae250038f615000d9
parentac2376e6f51677ab321930b0200a79d1683cfbba
glsl: Refactor variable declaration handling.

Moving the check for an earlier variable declaration helps cleanly
separate out the re-declaration vs. new declaration code a bit.  With
that in place, conflicts between variable names and structure types or
function names aren't caught by the earlier "redeclaration" error
message, so check the return type on glsl_symbol_table::add_variable
and issue an error there.  If one occurs, don't emit the initializer.

Fixes redeclaration-01.vert and redeclaration-09.vert.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp