UNPKG

jsii-pacmak

Version:

A code generation framework for jsii backend languages

102 lines 4.18 kB
import { Callable, Parameter, Property } from 'jsii-reflect'; import { ApiLocation } from 'jsii-rosetta'; import { SpecialDependencies } from '../dependencies'; import { EmitContext } from '../emit-context'; import { ParameterValidator } from '../runtime/runtime-type-checking'; import { GoClass, GoType, GoInterface, GoTypeRef } from './index'; export interface GoTypeMember { name: string; parent: GoType; reference?: GoTypeRef; returnType: string; specialDependencies: SpecialDependencies; } export declare class GoProperty implements GoTypeMember { #private; parent: GoType; readonly property: Property; readonly name: string; readonly setterName: string; readonly immutable: boolean; protected readonly apiLocation: ApiLocation; private _propertyForSignature?; constructor(parent: GoType, property: Property); get validator(): ParameterValidator | undefined; get reference(): GoTypeRef; get specialDependencies(): SpecialDependencies; get static(): boolean; get returnType(): string; private get returnTypeForDocs(); get instanceArg(): string; get override(): string; emitStructMember({ code, documenter }: EmitContext): void; emitGetterDecl({ code, documenter }: EmitContext): void; emitSetterDecl({ code, documenter }: EmitContext): void; emitGetterProxy(context: EmitContext): void; emitSetterProxy(context: EmitContext): void; /** * Returns the property we're overriding * * This is necessary because jsii allows classes to make the type of * properties in subclasses more specific (this is known as "covariant return * types"), but Go doesn't support this feature. * * If we render the signature of the property itself, and it has changed its * return type, Go will see that as two conflicting definitions of the same * accessor method. * * So instead, we will always render the type signature of the topmost method. * That is either the same as the current method (in which case it doesn't make * a difference), or it is a different signature, but then that's the one * we need to render to prevent the method collission. */ get propertyForSignature(): Property; } export declare abstract class GoMethod implements GoTypeMember { #private; readonly parent: GoClass | GoInterface; readonly method: Callable; readonly name: string; protected readonly apiLocation: ApiLocation; private _methodForSignature?; constructor(parent: GoClass | GoInterface, method: Callable); get parameters(): GoParameter[]; get validator(): ParameterValidator | undefined; abstract emit(context: EmitContext): void; abstract get specialDependencies(): SpecialDependencies; get reference(): GoTypeRef | undefined; get returnsRef(): boolean; get returnType(): string; get instanceArg(): string; get override(): string; get static(): boolean; paramString(): string; /** * Returns the first method we're overriding * * This is necessary because jsii allows classes to make the return type of * methods in subclasses more specific (this is known as "covariant return * types"), but Go doesn't support this feature. * * If we render the signature of the method itself, and it has changed its * return type, Go will see that as two conflicting definitions of the same * method. * * So instead, we will always render the type signature of the topmost method. * That is either the same as the current method (in which case it doesn't make * a difference), or it is a different signature, but then that's the one * we need to render to prevent the method collision. */ get methodForSignature(): Callable; } export declare class GoParameter { readonly name: string; readonly isOptional: boolean; readonly isVariadic: boolean; private readonly type; private readonly pkg; constructor(parent: GoClass | GoInterface, parameter: Parameter); get reference(): GoTypeRef; toString(): string; } //# sourceMappingURL=type-member.d.ts.map