/** * Class emission: the JavaScript class a `class` declaration becomes, its * constructor and field initializers, and the `@dispose` chain a derived class * runs through its base. */ import type { ClassDeclaration, Expression, Statement } from "../ast.ts"; import { type LoweringHints } from "../contracts.ts"; export interface ClassEmitterHost { blockAlwaysReturns(statements: readonly Statement[]): boolean; emitMappedExpression(expression: Expression, normalizeNull?: boolean): string; emitMappedStatement(statement: Statement, depth: number): string; emitParameter(name: string, defaultValue: Expression | null, rest?: boolean): string; emitStatementLines(statements: readonly Statement[], depth: number): readonly string[]; extensionExpressionContainsDirectAwait(_expression: Expression, _contains: (expression: Expression) => boolean): boolean | undefined; extensionStatementContainsDirectAwait(_statement: Statement, _containsExpression: (expression: Expression) => boolean, _containsBlock: (statements: readonly Statement[]) => boolean): boolean | undefined; readonly hints: LoweringHints; needsDisposalHelper: boolean; needsThrownValueHelper: boolean; } export declare class ClassEmitter { private readonly host; constructor(host: ClassEmitterHost); emitClass(statement: ClassDeclaration, depth: number): string; /** * CO-U8: the compiler-owned roles read in a stack under the words the author * wrote. `@dispose:` lowers to a member under a key no source name can spell, * and a failure inside it printed `at Handle.__velar:dispose` — the position * was right and the name was a compiler-internal spelling no document had * ever shown the author. The key stays what it is, because that is what keeps * the role uncallable from source; what the frame *says* is a label, and a * label is free to be the word the author wrote. * * The write is presentation, so it is emitted as presentation: the ambient * `Object.defineProperty` rather than a captured ABI, because the value is a * string constant and the target is a function this statement just created, * and a `catch` around it, because a host that replaced that operation with a * throwing one must cost the program a stack label rather than its startup. */ private memberLabelStatements; /** * D51 rule 102: derived first, base after — construction order reversed, the * same intuition LIFO release already has. The base runs on every exit from * the derived body, including a `return`, and when the derived part already * failed the base failure is reported to the host instead of replacing the * error in flight, exactly as rule 8 of D43 item 69 decides for `using`. */ private chainedDisposeLines; } //# sourceMappingURL=classes.d.ts.map