visitForLoop method

  1. @override
StringSink visitForLoop(
  1. ForLoop loop, [
  2. StringSink? output
])
inherited

Implementation

@override
StringSink visitForLoop(ForLoop loop, [StringSink? output]) {
  output ??= StringBuffer();
  if (loop.label != null) {
    output.writeln('${loop.label}:');
  }
  output.write('for (');
  if (loop.initialize != null) {
    loop.initialize!.accept(this, output);
  }
  output.write('; ');
  if (loop.condition != null) {
    loop.condition!.accept(this, output);
  }
  output.write('; ');
  if (loop.advance != null) {
    loop.advance!.accept(this, output);
  }
  output.writeln(') {');
  if (loop.body != null) {
    loop.body!.accept(this, output);
  }
  output.write(' }');
  return output;
}