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

Method print

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

Source from the content-addressed store, hash-verified

821 }
822
823 override print(ctx: PrintContext) {
824 this.type.markUsed(ctx);
825 const {isFullDeclaraion, isMethodDeclaration} = this.getPrintMode(ctx);
826 const isStatic = this.modifiers.includes('static');
827 if (!isStatic && isMethodDeclaration)
828 return '';
829 let result = ctx.prefix;
830 if (isStatic) {
831 if (isMethodDeclaration)
832 result += '// static\n'
833 else
834 result += 'static ';
835 }
836 result += `${this.type.print(ctx)} `;
837 result += isMethodDeclaration ? `${this.classDeclaration!.name}::${this.name}` : this.name;
838 if (this.initializer && isStatic == isMethodDeclaration)
839 result += ` = ${this.initializer.print(ctx)}`;
840 return result + ';';
841 }
842}
843
844export class MethodDeclaration extends ClassElement {

Callers

nothing calls this directly

Calls 3

includesMethod · 0.80
markUsedMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected