+void Formatter::visit(Block &block)
+{
+ unsigned brace_indent = indent;
+ bool use_braces = (block.use_braces || (indent && block.body.size()!=1));
+ if(use_braces)
+ append(format("%s{\n", string(brace_indent*2, ' ')));
+
+ SetForScope<unsigned> set(indent, indent+(indent>0 || use_braces));
+ string spaces(indent*2, ' ');
+ bool first = true;
+ for(NodeList<Statement>::iterator i=block.body.begin(); i!=block.body.end(); ++i)
+ {
+ if((*i)->source<=BUILTIN_SOURCE)
+ continue;
+ if(!first)
+ append('\n');
+ first = false;
+ set_source((*i)->source, (*i)->line);
+ append(spaces);
+ (*i)->visit(*this);
+ }
+
+ if(use_braces)
+ append(format("\n%s}", string(brace_indent*2, ' ')));
+}
+