functionSignatureOC method

String functionSignatureOC()

Implementation

String functionSignatureOC() {
  final sb = StringBuffer();

  if (isClassMethod) {
    sb.write('+' ' ');
  }
  if (isInstanceMethod) {
    sb.write('-' ' ');
  }

  sb.write('(${OCReference(returnType).build()})');
  sb.write(functionName);

  if (params.isNotEmpty) {
    sb.write(':');
    for (var i = 0; i < params.length; i++) {
      final param = params[i];
      if (i == 0) {
        sb.write(
            '(${OCReference(param.type, keepRaw: param.type.keepRaw).build()})${param.name}'); // NSInteger, Class, int, long, 抽一个组件 OCReference()
      } else {
        sb.write(
            '${param.name}:(${OCReference(param.type, keepRaw: param.type.keepRaw).build()})${param.name}');
      }
      if (i < params.length - 1) {
        sb.write(' ');
      }
    }
  }

  return sb.toString();
}