}
-void ParenthesizedExpression::visit(NodeVisitor &visitor)
-{
- visitor.visit(*this);
-}
-
-
VariableReference::VariableReference():
declaration(0)
{ }
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