/** * Whether an expression is settled before the first bar runs. * * `language.md` 13.2 states the rule once and every option, declaration field * and marker argument follows it: a literal, arithmetic over literals, or a * call to `input()`. A settings dialog and a legend are built before bar 0, so * a field that depended on a bar could not be filled in at the moment the host * needs it, and that is OS3003. * * An `input()` counts because it is resolved before bar 0 as well. The name a * script assigns an input to counts for the same reason, which is what lets * `table(position = corner)` work with `corner` declared above it. * * So does a colour built out of constants, which is the one call in the library * whose result is settled before bar 0 as surely as a literal is. `fade(red, 50)` * is the same four numbers on every bar, it is what a level and a marker are * normally coloured with, and refusing it would leave a script no way to write a * translucent colour in a field that has to be fixed. */ import type { Expression } from '../ast/index.js'; import type { Checker } from './checker.js'; /** * The calls that produce a value before the first bar, `stdlib.md` 11.2. * * A colour built out of constants is a constant: `fade(red, 50)` is the same * four numbers on every bar, and a level or a marker declared with one has a * colour to carry. The list is here, beside the rule, because the compiler folds * exactly these and the two have to be one list rather than two. A call this * accepted and the emitter could not fold would reach a declaration field with * nothing to write in it, and the compiler would have to refuse a script that * the checker had already passed. */ export declare const FOLDABLE_CALLS: ReadonlySet; export declare function isCompileTimeConstant(checker: Checker, expression: Expression): boolean; /** * Whether a constant reads a setting as part of something larger, OS3025. * * `compiled-program.md` 2.3 gives a field fixed before bar 0 two forms: the * effective value, which the compiler folds, and `{ "input": "" }`, one * setting resolved at load. `precision = input(2, "Decimals") + 1` and * `opacity = shade ? 1 : 0` are neither: the compiler cannot fold them, because * the setting's value is not known until the host resolves it, and the program * has no form for an expression evaluated at load. Nothing refused them, so the * emitter met them with no way to write them and reported a defect in itself. * * `wholeOnly` is false for an input's own options: a default, a bound or a * step is what the settings dialog shows before anybody has chosen, and a * setting that took its default from another setting would have none to show. */ export declare function readsInputInPart(checker: Checker, expression: Expression, wholeOnly: boolean): boolean; /** * Whether the expression names one of the price series an `input` may default * to, `stdlib.md` 13.1. * * A source input is the one place a bar series stands where a constant is * otherwise required: `input(close, "Source")` does not read `close`, it names * which column the study is to read, and the host resolves that before bar 0 * exactly as it resolves a number. */ export declare function isSourceName(expression: Expression): boolean; /** The dotted name a callee spells, or nothing when it is not a name at all. */ export declare function calleeNameOf(callee: Expression): string | undefined; //# sourceMappingURL=constant.d.ts.map