}
-void ParenthesizedExpression::visit(NodeVisitor &visitor)
-{
- visitor.visit(*this);
-}
-
-
VariableReference::VariableReference():
declaration(0)
{ }
InterfaceBlock::InterfaceBlock(const InterfaceBlock &other):
Statement(other),
interface(other.interface),
- name(other.name),
+ block_name(other.block_name),
members(other.members),
instance_name(other.instance_name),
array(other.array),
shared(Stage::SHARED)
{ }
+
+string get_unused_variable_name(const Block &block, const string &base)
+{
+ string name = base;
+
+ unsigned number = 1;
+ unsigned base_size = name.size();
+ while(1)
+ {
+ bool unused = true;
+ for(const Block *b=█ (unused && b); b=b->parent)
+ unused = !b->variables.count(name);
+ if(unused)
+ return name;
+
+ name.erase(base_size);
+ name += format("_%d", number);
+ ++number;
+ }
+}
+
} // namespace SL
} // namespace GL
} // namespace Msp