visitInvokeExpression method Null safety

  1. @override
StringSink visitInvokeExpression(
  1. InvokeExpression expression,
  2. [StringSink? output]
)
override

Implementation

@override
StringSink visitInvokeExpression(InvokeExpression expression,
    [StringSink? output]) {
  final out = output ??= StringBuffer();
  return _writeConstExpression(
      out, expression.type == InvokeExpressionType.constInstance, () {
    expression.target.accept(this, out);
    if (expression.name != null) {
      out
        ..write('.')
        ..write(expression.name);
    }
    if (expression.typeArguments.isNotEmpty) {
      out.write('<');
      visitAll<Reference>(expression.typeArguments, out, (type) {
        type.accept(this, out);
      });
      out.write('>');
    }
    out.write('(');
    visitAll<Spec>(expression.positionalArguments, out, (spec) {
      spec.accept(this, out);
    });
    if (expression.positionalArguments.isNotEmpty &&
        expression.namedArguments.isNotEmpty) {
      out.write(', ');
    }
    visitAll<String>(expression.namedArguments.keys, out, (name) {
      out
        ..write(name)
        ..write(': ');
      expression.namedArguments[name]!.accept(this, out);
    });
    return out..write(')');
  });
}