/** * What a subclass inherits and what it still owes: the subclass relation * itself, the base-chain walk a public member lookup is (`findField` and the * six other `find*` lookups climb `info.base` until a class publishes the * name), the private member tables `private` visibility is decided against, * and the abstract members a concrete class has left unimplemented. * * D114 R1d: the inheritance half of the class cluster. The lookups came here * rather than to `./members.ts` because what they do *is* the walk: a class's * own table is one `Map.get`, and everything else in them is the chain. */ import { type ClassField, type ClassInfo } from "../../contracts.ts"; import { type GenericApplication, type ValueType } from "../../types.ts"; /** * Everything this half of the class cluster asks of the analyzer that hosts * it. The four halves share one host object; the union of their interfaces is * what the analyzer builds. */ export interface ClassInheritanceHost { classApplicationFor(receiverKey: string, declarationKey: string): GenericApplication | null; classInfo(key: string): ClassInfo | undefined; readonly classes: Map; currentClass: string | null; isSubclassOf(actual: string, expected: string): boolean; readonly privateFields: Map>; readonly privateMethods: Map>; readonly privateStaticFields: Map>; readonly privateStaticMethods: Map>; substituteClassMemberType(type: ValueType, bindings: readonly ValueType[]): ValueType; } export declare class ClassInheritance { private readonly host; constructor(host: ClassInheritanceHost); /** * D55 rule 120 layer two: the chain is walked over *keys*, and an * instantiation's key already carries its arguments — `IntStack`'s base is * `Stack`, and `MyStack`'s is the `Stack` its own * arguments produced. So substitution happens once, when the entry is built, * and this walk needs no argument table of its own. * * One extra edge exists only for the erased runtime check: an instantiation * also reaches its bare declaration, because `is Stack` is `instanceof Stack` * and every `Stack` passes it. That edge cannot widen anything an author * wrote, because a bare generic class is not a type (rule 126) — it can only * be reached from an `is`/`case` pattern. */ isSubclassOf(actual: string, expected: string): boolean; unimplementedAbstractMethods(className: string): string[]; findField(className: string, name: string): ClassField | null; findGetter(className: string, name: string): { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; findMethod(className: string, name: string): { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; findStaticField(className: string, name: string): ClassField | null; findStaticFieldOwner(className: string, name: string): { readonly field: ClassField; readonly depth: number; } | null; findStaticGetter(className: string, name: string): ValueType | null; findStaticMethod(className: string, name: string): ValueType | null; privateFieldForAccess(className: string, name: string, staticMember: boolean): ClassField | null; privateMethodForAccess(className: string, name: string, staticMember: boolean): ValueType | null; /** * D55 rule 120 layer two: a private member lives in its own table, keyed by * the declaring class rather than by an instantiation, so it is the one * member surface `classInfo` does not substitute. It is substituted here * instead — with the arguments the *receiver* applies to the declaring class, * found by walking the receiver's own chain — because a private field of * `Stack` read through `self` is `T` and read through a `Stack` * receiver is `number`, exactly as a public one is. */ privateMemberType(type: ValueType, receiverKey: string): ValueType; declaresPrivateMember(className: string, name: string, staticMember: boolean): boolean; } //# sourceMappingURL=inheritance.d.ts.map