import { type Node, Parsed, type Range, Repeatable, Repeated } from "../../../parser"; import { ScriptParser } from "./script-parser"; export type Scope = ProgramScope | TagScope; export interface ProgramScope { parent: undefined; hoists: false; bindings: Bindings; } export interface TagScope { parent: Scope; hoists: boolean; bindings: undefined | Bindings; } export type Binding = VarBinding | ParamBinding | HoistedBinding; export interface VarBinding { type: BindingType.var; name: string; node: Node.ParentNode; scope: Scope; hoisted: boolean; mutated: boolean; sourceName: string | undefined; objectPath: string | undefined; } export interface ParamBinding { type: BindingType.param; name: string; node: Node.ParentNode; scope: Scope; hoisted: false; } export interface HoistedBinding { type: BindingType.hoisted; scope: Scope; bindings: Repeated; hoisted: false; } export declare enum BindingType { var = 0, param = 1, hoisted = 2 } export interface Mutation { start: number; binding: VarBinding; } type Bindings = { [name: string]: Binding; }; /** * Traverses the Marko tree and analyzes the bindings. */ export declare function crawlProgramScope(parsed: Parsed, ast: ScriptParser): [Mutation, ...Mutation[]] | [...Mutation[], Mutation] | undefined; export declare function getProgramBindings(node: Node.Program): { all: Repeated; vars: Repeatable; hoists: Repeatable; } | undefined; export declare function getMutatedVars(tag: Node.Tag): Repeatable; export declare function getHoistSources(body: Node.ParentNode["body"]): Repeatable; export declare function isMutatedVar(node: Node.ParentNode, name: string): boolean; export declare function hasHoists(node: Node.Tag): boolean; export declare function getBoundAttrRange(value: Node.AttrValue): { value: Range; types: undefined | Range; member: undefined | (Range & { computed: boolean; }); } | undefined; export {};