UNPKG

@informalsystems/quint

Version:

Core tool for the Quint specification language

47 lines (46 loc) 1.94 kB
import { LookupTable } from '../names/base'; import { IRVisitor } from '../ir/IRVisitor'; import { QuintApp, QuintBool, QuintConst, QuintDeclaration, QuintEx, QuintInt, QuintLambda, QuintLet, QuintName, QuintOpDef, QuintStr, QuintVar } from '../ir/quintIr'; import { EffectScheme } from './base'; import { ErrorTree } from '../errorTree'; export type EffectInferenceResult = [Map<bigint, ErrorTree>, Map<bigint, EffectScheme>]; export declare class EffectInferrer implements IRVisitor { constructor(lookupTable: LookupTable, effects?: Map<bigint, EffectScheme>); /** * Infers an effect for every expression in a module based on the definitions * table for that module. If there are missing effects in the effect map, * there will be at least one error. * * @param declarations: the list of QuintDeclarations to infer effects for * * @returns a map from expression ids to their effects and a map from expression * ids to the corresponding error for any problematic expressions. */ inferEffects(declarations: QuintDeclaration[]): EffectInferenceResult; private effects; private errors; private substitutions; private builtinSignatures; private lookupTable; private freshVarGenerator; private location; private freeNames; definitionDepth: number; enterExpr(e: QuintEx): void; exitConst(def: QuintConst): void; exitVar(def: QuintVar): void; exitName(expr: QuintName): void; exitApp(expr: QuintApp): void; exitLiteral(expr: QuintBool | QuintInt | QuintStr): void; exitOpDef(def: QuintOpDef): void; exitLet(expr: QuintLet): void; enterLambda(expr: QuintLambda): void; exitLambda(lambda: QuintLambda): void; private addToResults; private fetchResult; private effectForName; private newInstance; private currentFreeNames; private quantify; private addBindingsToFreeNames; }