visitAllObjects<T> method

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

Implementation

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