@informalsystems/quint
Version:
Core tool for the Quint specification language
46 lines (45 loc) • 1.72 kB
TypeScript
/**
* Name resolution for Quint modules.
*
* @author Gabriela Moreira
*
* @module
*/
import { IRVisitor } from '../ir/IRVisitor';
import { QuintApp, QuintInstance, QuintLambda, QuintLet, QuintModule, QuintName, QuintOpDef } from '../ir/quintIr';
import { QuintConstType } from '../ir/quintTypes';
import { LookupTable, NameResolutionResult, UnusedDefinitions } from './base';
import { QuintError } from '../quintError';
import { NameCollector } from './collector';
/**
* Resolves all names in the given Quint modules and returns a lookup table of definitions.
*
* @param quintModules - The Quint modules to resolve names in.
*
* @returns A lookup table of definitions and a mapping of unused definitions if successful, otherwise a list of errors.
*/
export declare function resolveNames(quintModules: QuintModule[]): NameResolutionResult;
/**
* `NameResolver` uses `NameCollector` to collect top-level definitions. Scoped
* definitions are collected inside of `NameResolver` as it navigates the IR.
*/
export declare class NameResolver implements IRVisitor {
collector: NameCollector;
errors: QuintError[];
table: LookupTable;
definitionDepth: number;
constructor();
unusedDefinitions: UnusedDefinitions;
switchToModule(moduleName: string): void;
enterModule(module: QuintModule): void;
enterOpDef(def: QuintOpDef): void;
exitLet(expr: QuintLet): void;
enterLambda(expr: QuintLambda): void;
exitLambda(expr: QuintLambda): void;
enterName(nameExpr: QuintName): void;
enterApp(appExpr: QuintApp): void;
enterConstType(type: QuintConstType): void;
enterInstance(def: QuintInstance): void;
private resolveName;
private recordNameError;
}