/** * The constant pool, `compiled-program.md` 2.9. * * Entries 0, 1 and 2 are absent, `false` and `true`, always, so `CONST 0` is * the whole of pushing absence and no instruction has to encode a literal. * Everything else is deduplicated, because a pool is per program and a literal * repeated forty times is forty pushes of one entry. * * An array literal is deliberately not poolable. It must produce a new array * every time it is evaluated, so it compiles to pushes and an `ARRAY` * instruction, and a shared pool object would be the same array on every bar. */ import type { Constant } from './program.js'; import type { Value } from './values.js'; export declare const ABSENT_INDEX = 0; export declare const FALSE_INDEX = 1; export declare const TRUE_INDEX = 2; export declare class ConstantPool { private readonly entries; private readonly byKey; get all(): readonly Constant[]; absent(): number; bool(value: boolean): number; number(value: number): number; string(value: string): number; colour(value: readonly [number, number, number, number]): number; /** The pool index for a folded value, or nothing when it is not poolable. */ of(value: Value): number | undefined; private intern; } /** A folded value as a constant entry, for an input's default and its options. */ export declare function constantOf(value: Value): Constant | undefined; //# sourceMappingURL=pool.d.ts.map