/** * `class` and `extern class`: the declaration head and its type parameters, the * constructor's parameter list (the one list that may declare fields), the * member forms — field, getter, method, `@init:`, `@dispose:`, `@iterate:` — * and the extern mirror of all of it. */ import type { ClassDeclaration, Expression, ExternClassDeclaration, Parameter, Statement, TypeParameterDeclaration, TypeReference, TypeSyntax } from "../../ast.ts"; import { type Diagnostic } from "../../diagnostic.ts"; import { type Token, type TokenKind } from "../../token.ts"; export interface ClassParserHost { advance(): Token; check(kind: TokenKind): boolean; checkWord(value: string): boolean; consumeNewlines(): void; current(): Token; readonly diagnostics: Diagnostic[]; expect(kind: TokenKind, message: string): Token; expectBindingName(message: string, noun: string): Token; expectMemberName(message?: string): Token; expectStatementEnd(): void; match(kind: TokenKind): boolean; parseBlock(): readonly Statement[]; parseDeclarationName(noun: "type" | "class" | "enum"): Token | null; parseExpression(minimumPrecedence?: number): Expression; parseParameters(): readonly Parameter[]; parseSpreadExpression(): Expression; parseTypeArgumentList(): readonly TypeSyntax[]; parseTypeParameters(): readonly TypeParameterDeclaration[] | null; parseTypeReference(allowTrailingOptional?: boolean, initialized?: boolean): TypeReference; peekKind(distance: number): TokenKind; previous(): Token; reportClassMemberReadonly(modifier: Token | null, member: "field" | "executable", code: string): void; reportExternDeclarationBody(): boolean; reportUntypedExternParameters(parameters: readonly Parameter[]): void; skipMistypedDeclaration(): void; synchronize(): void; } export declare class ClassParser { private readonly host; constructor(host: ClassParserHost); parseClassDeclaration(start: number, exported: boolean, abstract: boolean): ClassDeclaration | null; /** * A class body: every member it declares, and the `dedent` that closed it. * `parameters` arrives from the declaration head and leaves changed when the * body declares a `constructor(...)`, which is the one member that owns the * class's parameter list. */ private parseClassBody; /** * A compiler-owned class block. `@` always selects the contextual compiler * namespace; in a class that closed namespace holds `dispose` and `iterate`, * whose behaviour differs but whose resolution and rejection do not. Which * of the two was written is what this returns; whether the class already had * one is the body's question. */ private parseClassContextBlock; /** * The modifiers a class member may carry, read in any order. CLS-I5: * `readonly` is returned rather than reported, because the advice depends on * the member kind that follows — a field has `const`, an executable member * has no read-only contract at all. */ private scanClassMemberModifiers; /** * One `const`/`let` class field. Two shapes are answered here besides the * ordinary one: a field carrying method-only modifiers, and CLS-U7's * TypeScript optional-property spelling `let name?: T`, which VelarScript * has no syntax for — a field carries an optional type instead. */ private parseClassField; /** // D45 rule 79 (CLS-U1): `set name(value):` is the JavaScript accessor // shape. VelarScript has no setters (section 19), and the shape used to // fall through to three generic cascades that never said so. `get` has // its own parse path, so `set` gets the matching recognition — used only // to teach the rejection. `def set(...)` and a field named `set` are // other shapes and stay legal. */ private refuseClassSetter; /** * A class member that does not open with `def`: `pass`, a member declared * with another language's keyword — recovered as the method it meant when it * has that shape — or something the class body has no form for. The method * returned, when there is one, is the recovery's; `null` means the member * was answered without producing one. */ private parseMistypedClassMember; private parseClassGetter; private parseClassMethod; private parseClassConstructorParameters; parseExternClass(start: number): ExternClassDeclaration | null; /** * An extern class's head: its name, the two shapes it is refused for (type * parameters, and a constructor written as a parameter list rather than as a * `constructor(...)` member), its base, and the block opener. */ private parseExternClassHead; private parseExternClassParameters; } //# sourceMappingURL=classes.d.ts.map