| 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 | |
| 844 | export class MethodDeclaration extends ClassElement { |