visitAllObjects<T> method

void visitAllObjects<T>(
  1. void handler(
    1. T
    ),
  2. List<T> expressions,
  3. EmitterVisitorContext context,
  4. String separator, {
  5. bool newLine = false,
  6. bool keepOnSameLine = false,
})

Implementation

void visitAllObjects<T>(
  void Function(T) handler,
  List<T> expressions,
  EmitterVisitorContext context,
  String separator, {
  bool newLine = false,
  bool keepOnSameLine = false,
}) {
  const maxOutputLength = 80;
  var length = expressions.length;
  for (var i = 0; i < length; i++) {
    handler(expressions[i]);
    if (i != (length - 1)) {
      // Place separator.
      var newLine2 = keepOnSameLine
          ? context.currentLineLength > maxOutputLength
          : newLine;
      context.print(separator, newLine2);
    }
  }
  if (newLine) {
    context.println();
  }
}