import type es from 'estree'; import type { Environment, Node } from '../types'; import type Closure from './closure'; export declare enum InstrType { RESET = "Reset", WHILE = "While", FOR = "For", ASSIGNMENT = "Assignment", UNARY_OP = "UnaryOperation", BINARY_OP = "BinaryOperation", POP = "Pop", APPLICATION = "Application", BRANCH = "Branch", ENVIRONMENT = "Environment", ARRAY_LITERAL = "ArrayLiteral", ARRAY_ACCESS = "ArrayAccess", ARRAY_ASSIGNMENT = "ArrayAssignment", ARRAY_LENGTH = "ArrayLength", MARKER = "Marker", CONTINUE = "Continue", CONTINUE_MARKER = "ContinueMarker", BREAK = "Break", BREAK_MARKER = "BreakMarker", SPREAD = "Spread" } interface BaseInstr { instrType: T; srcNode: U; isEnvDependent?: boolean; } export interface WhileInstr extends BaseInstr { test: es.Expression; body: es.Statement; } export interface ForInstr extends BaseInstr { init: es.VariableDeclaration | es.Expression; test: es.Expression; update: es.Expression; body: es.Statement; } export interface DeclAssmtInstr extends BaseInstr { symbol: string; constant: boolean; declaration: true; } export interface RegularAssmtInstr extends BaseInstr { declaration: false; symbol: string; } export type AssmtInstr = DeclAssmtInstr | RegularAssmtInstr; export interface UnOpInstr extends BaseInstr { symbol: es.UnaryOperator; } export interface BinOpInstr extends BaseInstr { symbol: es.BinaryOperator; } export interface AppInstr extends BaseInstr { numOfArgs: number; } export interface BranchInstr extends BaseInstr { consequent: es.Expression | es.Statement; alternate: es.Expression | es.Statement | null | undefined; } export interface EnvInstr extends BaseInstr { env: Environment; } export interface ArrLitInstr extends BaseInstr { arity: number; } export type Instr = AppInstr | ArrLitInstr | AssmtInstr | BaseInstr | BinOpInstr | BranchInstr | EnvInstr | ForInstr | UnOpInstr | WhileInstr; export type InstrTypeToInstr = Extract extends never ? BaseInstr : Extract; export type ControlItem = (Node | Instr) & { isEnvDependent?: boolean; }; export type EnvArray = any[] & { readonly id: string; environment: Environment; }; export type HeapObject = EnvArray | Closure; export declare class CSEBreak { } export declare class CseError { readonly error: any; constructor(error: any); } export {};