visitMixin method

  1. @override
StringSink visitMixin(
  1. Mixin spec, [
  2. StringSink? output
])
inherited

Implementation

@override
StringSink visitMixin(Mixin spec, [StringSink? output]) {
  final out = output ??= StringBuffer();
  spec.docs.forEach(out.writeln);
  for (var a in spec.annotations) {
    visitAnnotation(a, out);
  }

  if (spec.base) {
    out.write('base ');
  }
  out.write('mixin ${spec.name}');
  visitTypeParameters(spec.types.map((r) => r.type), out);
  if (spec.on != null) {
    out.write(' on ');
    spec.on!.type.accept(this, out);
  }
  if (spec.implements.isNotEmpty) {
    out
      ..write(' implements ')
      ..writeAll(
          spec.implements.map<StringSink>((m) => m.type.accept(this)), ',');
  }
  out.write('  {');
  for (var f in spec.fields) {
    visitField(f, out);
    out.writeln();
  }
  for (var m in spec.methods) {
    visitMethod(m, out);
    if (_isLambdaMethod(m)) {
      out.write(';');
    }
    out.writeln();
  }
  out.write('  }');
  return out;
}