/** * The declarations that give the file its fixed shape, and the one instruction * per bar each of them still needs. * * **A declaration is not a per-bar instruction.** A `plot` call becomes a fixed * entry in `outputs.plots` plus one `EMIT` per bar, and the two halves are * decided at different times: the entry is settled before bar 0 because a * legend, a settings dialog and a pane have to exist before the first bar runs * (`language.md` 7.1), while the value is whatever the expression produced on * this bar. That split is why a declaration handle is a compile-time value with * nothing to compile into, and an emitter that treated the two alike would * break the type system the checker enforces. * * `table` is the far end of the same idea: it is a declaration with **no** * per-bar instruction at all. Its grid is declared here and its handle is one * of the things 2.11 says a slot holds, which the engine writes as it writes an * input's value. */ import type { Argument, Call } from '../ast/index.js'; import type { Binding } from '../check/index.js'; import type { Emitter, Frame } from './context.js'; import type { Field } from './program.js'; import type { Value } from './values.js'; /** The argument written for one parameter of a declaration call, or nothing. */ export declare function argumentFor(e: Emitter, call: Call, name: string): Argument | undefined; /** * A declaration field: what the script wrote, or the effective default. * * `compiled-program.md` 2.3 wants the value the option resolved to, defaults * included, so an option a script left out is written with its default rather * than omitted. An option the compiler cannot fold has nowhere in the format to * live, and that is a gap rather than a guess. */ export declare function fieldFor(e: Emitter, call: Call, name: string, defaults: Readonly>): Field; /** * The per-bar work one declaration needs, which for two of them is none. * * **Every caller of this is a statement that is entirely one declaration call**: * `plot(close, "C")` written on a line of its own, `panel = table(...)`, and * `len = input(14, "Length")`. `statements.ts` sends all three forms here * directly and `emitCall` sends nothing else, so reaching this function means * the call declares and nothing is waiting for a value from it. * * That invariant is here for one case, and it is worth the paragraph because * the case is easy to get subtly wrong in both directions. An `input()` is a * row of the settings dialog and a slot the engine writes at step 5 of every * bar, and 12.2 says in as many words that there is no instruction for one. But * that is the reading of `len = input(14, "Length")` only, where the name and * the input share one slot and the engine's write is the assignment. The same * call written inside an expression, which `language.md` 13.2 asks for on the * declaration line itself and 13.4 allows anywhere at the top level, has to * leave its value on the stack like any other expression, and an emitter that * emitted nothing there left the stack one value short and produced a program * refused at 3.5 check 5 with OS6018: a correct script told it had met a broken * compiler. * * So the two are told apart by **which caller they arrive through**, and never * by inspecting the call. The statement is the only place that can see whether * the call is the whole of itself, and it is the place that already knows: it * had to decide that anyway to know whether to emit a store. Asking here * instead would mean re-deriving from the checker's tables, at the one point * with the least context, a fact the caller was holding when it called. * * `inputs.ts` has the other half, which is the read. */ export declare function emitDeclarationCall(e: Emitter, f: Frame, call: Call, name: string, target: Binding | undefined): string | undefined; //# sourceMappingURL=outputs.d.ts.map