function withInstanceMethodForAttribute()

in src/plugins/builder.ts [271:314]


function withInstanceMethodForAttribute(
  supportsValueSemantics: boolean,
  attribute: ObjectSpec.Attribute,
): ObjC.Method {
  return {
    preprocessors: [],
    belongsToProtocol: null,
    code: [
      ObjectSpecCodeUtils.ivarForAttribute(attribute) +
        ' = ' +
        valueToAssignIntoInternalStateForAttribute(
          supportsValueSemantics,
          attribute,
        ) +
        ';',
      'return self;',
    ],
    comments: [],
    compilerAttributes: [],
    keywords: [
      {
        name: keywordNameForAttribute(attribute),
        argument: {
          name: keywordArgumentNameForAttribute(attribute),
          modifiers:
            ObjCNullabilityUtils.keywordArgumentModifiersForNullability(
              attribute.nullability,
            ),
          type: {
            name: attribute.type.name,
            reference: attribute.type.reference,
          },
        },
      },
    ],
    returnType: {
      type: {
        name: 'instancetype',
        reference: 'instancetype',
      },
      modifiers: [],
    },
  };
}