import type { FunctionCall, VariableNameLiteral } from "../types.js"; import { type WalkAncestor } from "../utils/node.js"; /** * Which AST positions hold a lexical name that has to resolve. * * Shared by the ordinary undefined-name diagnostics and the template one, * so all three make the same call. Not every `variableName` is a lookup * and not every `functionCall` is a bare call, and a pass that gets those * rules half right reports correct code. */ /** Is this node inside a `def` or `node` body? * * Those bodies have their own scope, so the top-level walk skips them or * every name in them fires twice. */ export declare function hasFunctionOrNodeAncestor(ancestors: readonly unknown[]): boolean; /** * Is this `variableName` a real read that has to resolve? * * The parser hands `null` over as a `variableName`, and it is a literal, * not a read. Two positions look like reads and are not. A `for` binder is a * declaration. A block-call parameter, as in `xs.map(\(item) -> item)`, * is a binding the typechecker's `Scope` does not track at all, so * resolving it would always fail. * * A name with no ancestors is a statement that is only a name, directly in * a function or node body. It is a read like any other. A TypeScript cast, * `return x as Json`, parses as `return x` followed by the names `as` and * `Json`, so this is where that mistake is reported. * * Names under a `valueAccess` are all real reads. A property name is not * a lookup, but `walkNodes` never yields one as a standalone name; what * it does yield with the access as parent is the base and the index and * slice expressions, as in `obj[i]` and `obj[lo:hi]`. */ export declare function isResolvableVariableReference(ref: VariableNameLiteral, ancestors: readonly WalkAncestor[]): boolean; /** * Is this `functionCall` a bare call whose name has to resolve? * * A synthetic call has no declaration to find, and the builder compiles * it away. A call under a `valueAccess` is `obj.foo()`, where `foo` is a * method rather than a lexical name; the access chain checks it instead. */ export declare function isResolvableBareCall(call: FunctionCall, ancestors: readonly WalkAncestor[]): boolean;