visitBlockStmt method

  1. @override
String visitBlockStmt(
  1. BlockStmt block
)
override

Implementation

@override
String visitBlockStmt(BlockStmt block) {
  final output = StringBuffer();
  if (block.statements.isNotEmpty) {
    output.writeln(' ${_lexicon.blockStart}');
    ++_curIndentCount;
    for (final stmt in block.statements) {
      final stmtString = formatAST(stmt);
      if (stmtString.isNotEmpty) {
        output.write(curIndent);
        output.writeln(stmtString);
      }
    }
    --_curIndentCount;
    output.write(curIndent);
    output.write(_lexicon.blockEnd);
  } else {
    output.write(' ${_lexicon.blockStart}${_lexicon.blockEnd}');
  }
  return output.toString();
}