/** * What the emitted module needs from the runtime: the walk that records which * helpers a program actually uses, and the helper sources the module carries * when it does not import them from a shared runtime module. * * D114 R1c: the five helper producers are `protected` members Web overrides, * so they stay declared on `JavaScriptEmitter` and forward here. */ import type { Expression, Program, Statement, TypeAliasDeclaration, TypeDeclaration } from "../ast.ts"; import { type ValueType } from "../types.ts"; import { type LoweringHints } from "../contracts.ts"; export interface RuntimeImportEmitterHost { binaryHelper(expression: Extract): string | null; collectionHelper(expression: Extract): string | null; readonly executeMain: boolean; readonly hints: LoweringHints; markRuntimeNarrowingType(type: ValueType, structural?: Set): void; markRuntimeType(type: ValueType): void; needsBinaryHelpers: boolean; needsCollectionHelpers: boolean; needsDetachedTaskHelper: boolean; needsDisposalHelper: boolean; needsIndexHelpers: boolean; needsThrownValueHelper: boolean; readonly requiredRuntimeModules: Set; readonly sharedRuntimeModules: boolean; readonly typeDeclarations: Map; visitExtensionRuntimeExpression(_expression: Expression, _visitExpression: (expression: Expression) => void): boolean; visitExtensionRuntimeStatement(_statement: Statement, _visitExpression: (expression: Expression) => void, _visitStatement: (statement: Statement) => void): boolean; } export declare class RuntimeImportEmitter { private readonly host; constructor(host: RuntimeImportEmitterHost); collectRuntimeUses(program: Program): void; /** * Every runtime helper one expression's lowering will need, recorded on the * emitter before a line is emitted so `emit()` knows what to import. */ private visitRuntimeExpression; /** * The same walk over a statement, including the declarations whose runtime * `Type` has to be built. */ private visitRuntimeStatement; /** * A `case` pattern's own uses: the values it compares against and the runtime * `Type` a type pattern checks. */ private visitRuntimeMatchPattern; reactiveBridgeHelpers(needsJavaScriptCallBoundary: boolean, needsCollections: boolean, usedIdentifiers?: ReadonlySet): readonly string[]; detachedTaskHelpers(): readonly string[]; /** * D43 item 69 rule 8: a release that fails while an error is already in * flight must not replace it. The original error keeps the throw; the release * failure is normalized and reported through the host channel. The reporter * itself never fails outward, for the same reason the detached-task reporter * does not — a throw inside it would end the process. */ disposalHelpers(): readonly string[]; /** * D51 rule 103: the three failures that mean "this program has a bug", by the * one name each of them stamps on itself. A forged name can only make a * failure propagate instead of becoming `null`, which is the safe direction: * `try` never hides a guard, and `catch` still receives everything. */ integrityFailureHelpers(): readonly string[]; /** * D86 rule 212: `value!` raises the same `AssertionError` an * `assert value != null` raises, so the integrity check above keeps letting * it through `try` — a broken assertion is a bug, never a "not found". */ requiredValueHelpers(): readonly string[]; } //# sourceMappingURL=runtime-imports.d.ts.map