in src/objc-renderer.ts [1269:1324]
function implementationClassSection(classInfo: ObjC.Class): string {
const macros = classMacros(classInfo);
const prefixClassMacrosSection: string = codeSectionForCodeString(
macros.map(toPrefixMacroString).join('\n'),
);
const classSection: string = '@implementation ' + classInfo.name + '\n';
const instanceVariablesStr: string = classInfo.instanceVariables
.filter(implementationNeedsToIncludeInstanceVariable)
.map(toInstanceVariableString)
.map(StringUtils.indent(2))
.join('\n');
const instanceVariablesSection: string =
instanceVariablesStr !== ''
? '{\n' + instanceVariablesStr + '\n}\n\n'
: '\n';
const classMethodsStr: string = classInfo.classMethods
.filter(methodIsNotUnavailableNSObjectMethod)
.map((method) =>
toClassMethodImplementationString(classInfo.covariantTypes, method),
)
.join('\n\n');
const classMethodsSection = codeSectionForCodeString(classMethodsStr);
const instanceMethodsSection = Maybe.catMaybes(
classInfo.instanceMethods
.filter(methodIsNotUnavailableNSObjectMethod)
.map((method) =>
toInstanceMethodImplementationString(classInfo.covariantTypes, method),
),
).join('\n\n');
const functionsStr = (classInfo.functions || [])
.filter((func) => !(func.isInline && func.isPublic))
.map(toFunctionImplementationString)
.join('\n\n');
const functionsSection = codeSectionForCodeString(functionsStr);
const postfixClassMacrosSection: string =
precedingTwoSpacePaddingForCodeString(
macros.map(toPostfixMacroString).join('\n'),
);
return (
(
prefixClassMacrosSection +
classSection +
instanceVariablesSection +
functionsSection +
classMethodsSection +
instanceMethodsSection
).trim() +
'\n\n@end' +
postfixClassMacrosSection
);
}