/** * What a receiver publishes: the type under one name, and every name it has. * * D114 F4: there were two answers to this question. The type checker resolved * one name at a time in `MemberAccess.receiverMember`, and the semantic index * built the editor's roster in `createSemanticMembersOf` — a second walk with * its own hard-coded member lists, its own class-chain walk, and its own enum * and `Type` member construction. They disagreed: the editor's List roster * predated the D114 S3 pipeline members, a private field read through an * applied receiver kept its declaration's `T` instead of the argument, and a * `type` alias of an enum published `is`/`parse` where the checker published * the enum's members. One concept, one definition: this module answers both * questions from one set of resolvers, so a member the checker accepts is the * member the editor shows, and a member the editor offers is one the checker * will accept. * * Nothing here reports a diagnostic or records a lowering fact. A refusal is * the checker's to make and stays in `members.ts`, which asks this module what * the receiver publishes and then decides what to say when the answer is * nothing. */ import { type AdvisoryRecordShape } from "./advisories.ts"; import { type ClassField, type ClassInfo, type CompilerAnalysisExtension } from "../contracts.ts"; import { type ValueType } from "../types.ts"; /** * The checked value methods a string carries with it, as one table. It is a * table rather than a `switch` because the roster and the resolver are the same * fact: the names the editor offers are the keys, and the contract each one * resolves to is the value. */ export declare const STRING_MEMBER_CONTRACTS: ReadonlyMap; /** The same, for a number. */ export declare const NUMBER_MEMBER_CONTRACTS: ReadonlyMap; /** * The five things a class receiver can publish under one name, in the order a * read prefers them. The checker needs the parts — a private member lowers * differently from a public one, a method read as a value binds at its * reference site, a field read runs the initialization guard — and the editor * needs only `type`. Both read the same lookup, so neither can drift. */ export interface ClassMemberParts { readonly privateField: ClassField | null; readonly privateMethod: ValueType | null; readonly field: ClassField | null; readonly getter: { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; readonly method: { readonly owner: string; readonly type: ValueType; readonly abstract: boolean; } | null; readonly type: ValueType | null; } /** The same for a class constructor, where a static field also carries its depth. */ export interface StaticMemberParts { readonly privateField: ClassField | null; readonly privateMethod: ValueType | null; readonly fieldOwner: { readonly field: ClassField; readonly depth: number; } | null; readonly field: ClassField | null; readonly getter: ValueType | null; readonly method: ValueType | null; readonly type: ValueType | null; } /** What the published-member resolver asks of the analyzer that hosts it, and nothing more. */ export interface PublishedMembersHost { aliasedEnumTarget(name: string): { readonly name: string; readonly identity: string; readonly members: ReadonlySet; } | null; readonly analysisExtensions: readonly CompilerAnalysisExtension[]; classInfo(key: string): ClassInfo | undefined; currentClass: string | null; discriminatedDataField(original: ValueType, property: string): ValueType | null; displayExternalClasses(type: ValueType): ValueType; enumRuntimeMember(name: string, identity: string, members: ReadonlySet, property: string): ValueType | null; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; fieldsOf(identity: string): ReadonlyMap | null; 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; 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; readonly invalidDeclaredTypes: Set; isSubclassOf(actual: string, expected: string): boolean; listMember(list: Extract, property: string): ValueType | null; mapMember(map: Extract, property: string): ValueType | null; privateFieldForAccess(className: string, name: string, staticMember: boolean): ClassField | null; privateMethodForAccess(className: string, name: string, staticMember: boolean): ValueType | null; readonly privateFields: Map>; readonly privateMethods: Map>; readonly privateStaticFields: Map>; readonly privateStaticMethods: Map>; readonlyDataViewOf(type: ValueType): ValueType; readonlyFieldsOf(identity: string): ReadonlySet | null; recordMember(record: Extract, property: string): ValueType | null; recordProjectionShape(type: ValueType): AdvisoryRecordShape | null; runtimeTypeObjectValue(type: Extract): ValueType; setMember(set: Extract, property: string): ValueType | null; } export declare class PublishedMembers { private readonly host; constructor(host: PublishedMembersHost); stringMember(property: string): ValueType | null; numberMember(property: string): ValueType | null; /** * What `receiver` publishes under `property` when it is read, or `null` when * it publishes nothing under that name. The receiver arrives already expanded * and non-optional — the same shape `inferMember` hands to `receiverMember`. */ member(receiver: ValueType, property: string): ValueType | null; /** * Every name `receiver` publishes, with the type each one publishes. The * names come from the compiler-owned rosters or from the receiver's own * declaration; the type of each comes from `member`, so the roster cannot * offer a name the checker would refuse or describe one differently. */ roster(receiver: ValueType): ReadonlyMap; /** Display extern classes under their published names; reads retain the member type. */ private asRead; /** The names one receiver publishes: a compiler-owned roster, or its own declaration's. */ private publishedNames; /** * The names a class chain publishes, first declaration winning, plus the * private members visible from the class under analysis — the same two tables * `findMethod` and `privateMethodForAccess` read, walked in the same order. */ private classChainNames; /** * The class whose private tables this receiver may be read through: the same * accessibility test `privateFieldForAccess` applies before it looks a name * up, so the roster lists exactly the private members a read would resolve. */ private privateMemberOwner; /** The five class lookups a read prefers in order, and the type they settle on. */ classMemberParts(object: Extract, property: string): ClassMemberParts; /** The same for the static side of a class. */ staticMemberParts(object: Extract, property: string): StaticMemberParts; private actionMember; private objectMember; private namedMember; private extensionMember; /** * A union publishes a field only when every variant carries it: the field as * each variant declares it, or `null` when one of them does not have it at * all. A read answers their union; an assignment through the union needs the * variants themselves, which is why the parts are published as well. */ unionCandidates(object: Extract, property: string): readonly ValueType[] | null; private unionMember; /** * A union's roster is the names every variant publishes — asked of the * variants themselves, so a union of two records offers their common fields * — with the type each name publishes settled by `unionMember`, which is what * a read of it resolves to. */ private unionRoster; /** * ENM-I4: identities follow aliases, so a `type` name whose target is an enum * publishes the enum's members. Everything else publishes `is` and `parse`, * plus the exact projection `from` when the value it stands for has one. */ private typeObjectMember; /** A declaration whose own type was refused parses to nothing usable (D90). */ private typeObjectValue; private typeObjectNames; private runtimeTypeMember; } //# sourceMappingURL=published-members.d.ts.map