void ProgramCompiler::inject_block(Block &target, const Block &source)
{
- list<RefPtr<Statement> >::iterator insert_point = target.body.begin();
- for(list<RefPtr<Statement> >::const_iterator i=source.body.begin(); i!=source.body.end(); ++i)
+ NodeList<Statement>::iterator insert_point = target.body.begin();
+ for(NodeList<Statement>::const_iterator i=source.body.begin(); i!=source.body.end(); ++i)
target.body.insert(insert_point, (*i)->clone());
}
remove_node = true;
}
-void ProgramCompiler::BlockModifier::apply_and_increment(Block &block, list<RefPtr<Statement> >::iterator &i)
+void ProgramCompiler::BlockModifier::apply_and_increment(Block &block, NodeList<Statement>::iterator &i)
{
block.body.insert(i, insert_nodes.begin(), insert_nodes.end());
insert_nodes.clear();
void ProgramCompiler::BlockModifier::visit(Block &block)
{
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); )
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); )
{
(*i)->visit(*this);
apply_and_increment(block, i);
void ProgramCompiler::Formatter::visit(FunctionCall &call)
{
formatted += format("%s(", call.name);
- for(vector<RefPtr<Expression> >::iterator i=call.arguments.begin(); i!=call.arguments.end(); ++i)
+ for(NodeArray<Expression>::iterator i=call.arguments.begin(); i!=call.arguments.end(); ++i)
{
if(i!=call.arguments.begin())
formatted += ", ";
SetForScope<unsigned> set(indent, indent+(indent>0 || use_braces));
string spaces(indent*2, ' ');
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); ++i)
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); ++i)
{
if(i!=block.body.begin())
formatted += '\n';
void ProgramCompiler::Formatter::visit(FunctionDeclaration &func)
{
formatted += format("%s %s(", func.return_type, func.name);
- for(vector<RefPtr<VariableDeclaration> >::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
+ for(NodeArray<VariableDeclaration>::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
{
if(i!=func.parameters.begin())
formatted += ", ";
void ProgramCompiler::InterfaceGenerator::visit(Block &block)
{
SetForScope<unsigned> set(scope_level, scope_level+1);
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); )
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); )
{
(*i)->visit(*this);
{
for(map<string, RefPtr<VariableDeclaration> >::iterator j=iface_declarations.begin(); j!=iface_declarations.end(); ++j)
{
- list<RefPtr<Statement> >::iterator k = block.body.insert(i, j->second);
+ NodeList<Statement>::iterator k = block.body.insert(i, j->second);
(*k)->visit(*this);
}
iface_declarations.clear();
if(scope_level>1)
return Visitor::visit(block);
- list<RefPtr<Statement> >::iterator struct_insert_point = block.body.end();
- list<RefPtr<Statement> >::iterator variable_insert_point = block.body.end();
- list<RefPtr<Statement> >::iterator function_insert_point = block.body.end();
+ NodeList<Statement>::iterator struct_insert_point = block.body.end();
+ NodeList<Statement>::iterator variable_insert_point = block.body.end();
+ NodeList<Statement>::iterator function_insert_point = block.body.end();
unsigned unordered_func_count = 0;
bool ordered_any_funcs = false;
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); )
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); )
{
kind = NO_DECLARATION;
(*i)->visit(*this);
if(extract_result)
--extract_result;
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); ++i)
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); ++i)
{
(*i)->visit(*this);
if(extract_result)
void ProgramCompiler::FunctionInliner::visit(FunctionCall &call)
{
- for(vector<RefPtr<Expression> >::iterator i=call.arguments.begin(); i!=call.arguments.end(); ++i)
+ for(NodeArray<Expression>::iterator i=call.arguments.begin(); i!=call.arguments.end(); ++i)
visit_and_inline(*i);
FunctionDeclaration *def = call.declaration;
{
SetForScope<bool> set(global_scope, false);
- for(vector<RefPtr<VariableDeclaration> >::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
+ for(NodeArray<VariableDeclaration>::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
(*i)->visit(*this);
func.body.visit(*this);
}
BlockVariableMap &block_variables = variables.back();
for(BlockVariableMap::iterator i=block_variables.begin(); i!=block_variables.end(); ++i)
i->second.conditionally_assigned = true;
- for(vector<RefPtr<VariableDeclaration> >::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
+ for(NodeArray<VariableDeclaration>::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
block_variables[i->get()].referenced = true;
merge_down_variables();
}
void ProgramCompiler::NodeRemover::visit(Block &block)
{
- for(list<RefPtr<Statement> >::iterator i=block.body.begin(); i!=block.body.end(); )
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); )
{
(*i)->visit(*this);
if(to_remove.count(i->get()))
{
if(call.name=="texture" && !call.declaration && !supports_unified_sampling_functions())
{
- vector<RefPtr<Expression> >::iterator i = call.arguments.begin();
+ NodeArray<Expression>::iterator i = call.arguments.begin();
if(i!=call.arguments.end())
{
(*i)->visit(*this);