/** * A watch subject as the author wrote it: the allowlist of shapes a subject may * be, and the reconstruction of one back into the source text a refusal quotes. * * D115 P4 R3a: the reconstruction is a total function over an expression, so it * reads as a module. Its per-kind renderers are named rather than inlined into * one switch, because a reader who arrives asking how a call or an f-string is * printed should be able to be sent to the answer. */ import { type Expression } from "@velarscript/compiler/extension"; /** * D90 R15(a): a watch subject names a place in the reactive graph — the name of * a `state` or a `computed`, or a read path out of one — and never computes a * value. The rule is written positively, as this allowlist, because that is * what makes the relation between a watch and its source *declared* rather than * inferred; every earlier attempt to infer it was defeated by one more * indirection. A path is legal at any depth and with any index expression: * `rows[i].cells[j]` still selects a place, and whether `i` is a constant or * another state changes nothing about that. An operator or a call derives a new * value instead, and a derived value already has a spelling that names it, * caches it, and declares its dependencies. The conditional is an operator by * the charter's own vocabulary, and an f-string builds a new string, so neither * needs a clause of its own — they simply are not paths. * * Whether the root of a legal path is reactive is a different question, and * `frozenWatchSubject` keeps it: this answers shape only. */ export declare function watchSubjectPath(expression: Expression): boolean; /** * The subject as the author wrote it, reconstructed from the AST for exactly * the node kinds a subject can be. The analyzer never sees the module text, and * a refusal that cannot quote what it refused teaches nothing — so the message * quotes this. It is a reconstruction and stays one: it is used in the message * only, never in a `fix`, because rewriting an author's source from a * reconstruction is a worse defect than the one being reported. Null means * "cannot say faithfully", and the message drops the echo rather than guess. * * Faithfulness is the whole point, so grouping is carried across rather than * re-derived: the three nodes that record the author's own parentheses are * printed with them, and the low-precedence nodes that record nothing are * parenthesized wherever a bare printing would re-associate. The reconstruction * therefore parses back to the tree it came from. */ export declare function renderWatchSubject(expression: Expression): string | null; //# sourceMappingURL=watch-subject.d.ts.map