MCPcopy Create free account
hub / github.com/compilets/compilets / print

Method print

src/cpp-syntax.ts:958–972  ·  view source on GitHub ↗
(ctx: PrintContext)

Source from the content-addressed store, hash-verified

956 }
957
958 override print(ctx: PrintContext) {
959 const type = this.type as FunctionType;
960 type.markUsed(ctx);
961 const returnType = type.returnType.print(ctx);
962 const parameters = ParameterDeclaration.printParameters(ctx, this.parameters);
963 const templateDeclaration = printTemplateDeclaration(type);
964 let result = `${returnType} ${this.name}(${parameters})`;
965 if (ctx.mode == 'impl' || (ctx.mode == 'header' && templateDeclaration))
966 result += ' ' + (this.body?.print(ctx) ?? '{}');
967 else
968 result += ';';
969 if (templateDeclaration)
970 return templateDeclaration + '\n' + result;
971 return result;
972 }
973}
974
975export class VariableStatement extends DeclarationStatement {

Callers

nothing calls this directly

Calls 4

printTemplateDeclarationFunction · 0.90
printParametersMethod · 0.80
markUsedMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected