*/
public void makeVariable(Binding var, Name var_type, IMetaInfo[] meta_tags, Object initializer, VariableMutability mutability)
{
assert (initializer == null || SemanticUtils.isConstDefinition(var.getDefinition())) : "only consts can have an initializer";
Name var_name = var.getName();
if ( var_name == null || this.declaredVariables.contains(var_name) )
{
return;
}
declareVariableName(var_name);
IDefinition var_def = var.getDefinition();
if ( this.localsInRegisters() )
{
// The Binding will already be in localBindings if it was referenced
// before it was set; if not, add it.
if ( !this.localBindings.containsKey(var_name.getBaseName()) )
{
if ( var.getNode() instanceof BaseVariableNode )
{
IExpressionNode name_node = ((BaseVariableNode)var.getNode()).getNameExpressionNode();
Binding var_binding = getBinding(name_node, var_name, var_def);
this.localBindings.put(var_name.getBaseName(), var_binding);
var_binding.setIsLocal(true);
}
else
{
// Error case, synthesize a Binding.
Binding error_binding = new Binding(var.getNode(), new Name("error in binding"), null);
this.localBindings.put(var_name.getBaseName(), error_binding);
}
}
}
else
{