* after the initializer if present or immediately after the name
* being declared if not."
*/
- if (!state->symbols->add_variable(var->name, var)) {
+ if (!state->symbols->add_variable(var)) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "name `%s' already taken in the "
"current scope", decl->identifier);
_mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name);
} else {
- state->symbols->add_variable(var->name, var);
+ state->symbols->add_variable(var);
}
}
return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
}
-bool glsl_symbol_table::add_variable(const char *name, ir_variable *v)
+bool glsl_symbol_table::add_variable(ir_variable *v)
{
if (this->language_version == 110) {
/* In 1.10, functions and variables have separate namespaces. */
- symbol_table_entry *existing = get_entry(name);
- if (name_declared_this_scope(name)) {
+ symbol_table_entry *existing = get_entry(v->name);
+ if (name_declared_this_scope(v->name)) {
/* If there's already an existing function (not a constructor!) in
* the current scope, just update the existing entry to include 'v'.
*/
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
if (existing != NULL)
entry->f = existing->f;
- int added = _mesa_symbol_table_add_symbol(table, -1, name, entry);
+ int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
assert(added == 0);
(void)added;
return true;
/* 1.20+ rules: */
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
- return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+ return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
}
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
* reduces the clarity of the intention of code that uses these methods.
*/
/*@{*/
- bool add_variable(const char *name, ir_variable *v);
+ bool add_variable(ir_variable *v);
bool add_type(const char *name, const glsl_type *t);
bool add_function(ir_function *f);
/*@}*/
}
// Add the variable to the symbol table
- st->symbols->add_variable(var->name, var);
+ st->symbols->add_variable(var);
return var;
}
*/
instructions->push_tail(var);
- symtab->add_variable(var->name, var);
+ symtab->add_variable(var);
return var;
}
* it to the linked shader.
*/
var = ir->var->clone(linked, NULL);
- linked->symbols->add_variable(var->name, var);
+ linked->symbols->add_variable(var);
linked->ir->push_head(var);
}
var->constant_value->clone(talloc_parent(existing), NULL);
}
} else
- variables.add_variable(var->name, var);
+ variables.add_variable(var);
}
}
if ((var == NULL) || (var->mode != ir_var_out))
continue;
- parameters.add_variable(var->name, var);
+ parameters.add_variable(var);
}
if ((func = inst->as_function()) != NULL) {
sh->symbols->add_function(func);
} else if ((var = inst->as_variable()) != NULL) {
- sh->symbols->add_variable(var->name, var);
+ sh->symbols->add_variable(var);
}
}
}
else {
ir_variable *copy = ir->var->clone(this->target, NULL);
- this->symbols->add_variable(copy->name, copy);
+ this->symbols->add_variable(copy);
this->instructions->push_head(copy);
ir->var = copy;
}