* A pointer to an existing variable in the current scope if the declaration
* is a redeclaration, \c NULL otherwise.
*/
-ir_variable *
-get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,
+static ir_variable *
+get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
struct _mesa_glsl_parse_state *state)
{
/* Check if this declaration is actually a re-declaration, either to
* This is allowed for variables in the current scope, or when at
* global scope (for built-ins in the implicit outer scope).
*/
- ir_variable *earlier = state->symbols->get_variable(decl->identifier);
+ ir_variable *earlier = state->symbols->get_variable(var->name);
if (earlier == NULL ||
(state->current_function != NULL &&
- !state->symbols->name_declared_this_scope(decl->identifier))) {
+ !state->symbols->name_declared_this_scope(var->name))) {
return NULL;
}
- YYLTYPE loc = decl->get_location();
-
/* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,
*
* "It is legal to declare an array without a size and then
earlier->depth_layout = var->depth_layout;
} else {
- _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier);
+ _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name);
}
return earlier;
* instruction stream.
*/
exec_list initializer_instructions;
- ir_variable *earlier = get_variable_being_redeclared(var, decl, state);
+ ir_variable *earlier =
+ get_variable_being_redeclared(var, decl->get_location(), state);
if (decl->initializer != NULL) {
result = process_initializer((earlier == NULL) ? var : earlier,