/** * The standard-module intrinsics: per-module argument checking for * `velar/json`, `velar/async`, the remaining module vocabularies, `range`, and * `equals`, plus the one in-flight object all of them share. * * D114 R1b recorded why this is call checking rather than module vocabulary: * two thirds of it is the named-argument plan and the argument helpers, it * reads none of the vocabulary tables (`jsonNamespaceType`, * `mathNamespaceMembers`, …), and it is reached from nowhere but `inferCall`. * * D115 §三 gives it its own file. `inferIntrinsicCall` is the whole of what * leaves it: the per-module rules are tried in the order the one 303-line * method tried them, and each answers `null` for an intrinsic it does not own. */ import { type Expression } from "../../ast.ts"; import { type CompilerAnalysisExtension, type FormReadField } from "../../contracts.ts"; import { type DiagnosticFix } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type ValueType } from "../../types.ts"; import { type NamedArguments } from "./named-arguments.ts"; /** * The lowering side tables an intrinsic call writes. `LoweringRecorder` * satisfies this; naming only what is written keeps its other tables out of * this file's dependency face. */ interface IntrinsicLoweringFacts { readonly equalsCalls: Set; readonly formReads: Map; readonly namedArgumentOrders: Map; } /** What the intrinsic rules ask of the analyzer that hosts them, and nothing more. */ export interface IntrinsicCallsHost { readonly analysisExtensions: readonly CompilerAnalysisExtension[]; checkArguments(arguments_: readonly Expression[], parameters: readonly ValueType[], callSpan: Span, requiredParameters?: number, rest?: ValueType, argumentNames?: readonly (string | null)[], parameterNames?: readonly string[]): void; concreteCallableFor(actual: ValueType, expected: ValueType, errorSpan?: Span): ValueType; enumMeetDomain(left: ValueType, right: ValueType): "string" | "number"; equalityGuidance(leftSource: ValueType, rightSource: ValueType): string; equalityTypesIntersect(leftSource: ValueType, rightSource: ValueType): boolean; equalsDomainViolation(source: ValueType, seen?: Set): string | null; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; fieldsOf(identity: string): ReadonlyMap | null; formReadField(name: string, source: ValueType, fieldSpan: Span): FormReadField | null; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; inferredExpressionType(expression: Expression): ValueType; /** * `isAssignable` judged against the analyzer as the type environment, which * is all the intrinsic extension hook asks of it. */ isAssignableHere(actual: ValueType, expected: ValueType): boolean; isHttpFormBody(source: ValueType): boolean; jsonSerializable(source: ValueType, seen?: ReadonlySet): boolean | null; readonly lowering: IntrinsicLoweringFacts; readonly namedTypes: Map>; reportPromiseResolutionHazard(type: ValueType, errorSpan: Span): void; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span): void; runtimeTypeObjectValue(type: Extract): ValueType; readonly testExpectOperands: Map; typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void; typesIntersect(leftSource: ValueType, rightSource: ValueType, enumStringVeto: boolean): boolean; } export declare class IntrinsicCalls { private readonly host; private readonly namedArguments; constructor(host: IntrinsicCallsHost, namedArguments: NamedArguments); inferIntrinsicCall(intrinsic: Extract, sourceArguments: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType; /** * The arguments the per-intrinsic rules see. A named call is planned against * the intrinsic's published parameter names and inferred here, before any * rule runs; arrow arguments are held back so the rule that knows their * contract infers them. A plan that did not resolve answers the whole call. */ private resolveIntrinsicArguments; /** A target extension may own an intrinsic of its own vocabulary; it is asked first. */ private inferExtensionIntrinsic; /** The `velar/json` intrinsics and the runtime-Type parse they share. */ private inferJsonIntrinsic; /** The `velar/async` intrinsics: the combinators over Promises. */ private inferAsyncIntrinsic; /** The remaining standard-module intrinsics, and the declared-signature default. */ private inferOtherIntrinsic; private inferRangeCall; private inferEqualsCall; } export {}; //# sourceMappingURL=intrinsics.d.ts.map