visitForStmt method

  1. @override
String visitForStmt(
  1. ForStmt forStmt
)
override

Implementation

@override
String visitForStmt(ForStmt forStmt) {
  final output = StringBuffer();
  output.write('${_lexicon.kFor} ');
  if (forStmt.hasBracket) {
    output.write(_lexicon.groupExprStart);
  }
  final declString = forStmt.init != null ? formatAST(forStmt.init!) : '';
  final conditionString =
      forStmt.condition != null ? formatAST(forStmt.condition!) : '';
  final incrementString =
      forStmt.increment != null ? formatAST(forStmt.increment!) : '';
  output.write(
      '$declString${_lexicon.endOfStatementMark} $conditionString${_lexicon.endOfStatementMark} $incrementString');
  if (forStmt.hasBracket) {
    output.write('${_lexicon.groupExprEnd} ');
  }
  final loopString = formatAST(forStmt.loop);
  output.write(loopString);
  return output.toString();
}