@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
47 lines (46 loc) • 3.35 kB
TypeScript
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
import { AbstractDomain, type AnyAbstractDomain, type ConcreteDomain } from './abstract-domain';
import { Bottom, Top } from './lattice';
import type { StateDomainLike } from './state-domain-like';
/** The type of the concrete state of the concrete domain of a state abstract domain that maps keys to a concrete value in the concrete domain */
export type ConcreteState<Domain extends AnyAbstractDomain> = ReadonlyMap<NodeId, ConcreteDomain<Domain>>;
/** The type of the actual values of the state abstract domain as map of keys to domain values */
export type StateDomainValue<Domain extends AnyAbstractDomain> = ReadonlyMap<NodeId, Domain>;
/** The type of the Top element of the state abstract domain as (empty) map of keys to domain values */
export type StateDomainTop = ReadonlyMap<NodeId, never>;
/** The type of the Bottom element of the state abstract domain as {@link Bottom} symbol */
export type StateDomainBottom = typeof Bottom;
/** The type of the abstract values of the state abstract domain that are Top, Bottom, or actual values */
export type StateDomainLift<Domain extends AnyAbstractDomain> = StateDomainValue<Domain> | StateDomainBottom;
/**
* A state abstract domain that maps AST node IDs of a program to abstract values of an abstract domain.
* The Bottom element is defined as {@link Bottom} symbol and the Top element as empty mapping.
* @template Domain - Type of the value abstract domain to map the AST node IDs to
* @see {@link NodeId} for the node IDs of the AST nodes
*/
export declare class StateAbstractDomain<Domain extends AnyAbstractDomain, Value extends StateDomainLift<Domain> = StateDomainLift<Domain>> extends AbstractDomain<ConcreteState<Domain>, StateDomainValue<Domain>, StateDomainTop, StateDomainBottom, Value> implements StateDomainLike<Domain> {
readonly domain: Domain;
constructor(value: Value, domain: Domain);
create(value: StateDomainLift<Domain>): this;
static top<Domain extends AnyAbstractDomain, StateDomain extends StateAbstractDomain<Domain, StateDomainTop>>(this: new (value: StateDomainTop, domain: Domain) => StateDomain, domain: Domain): StateDomain;
static bottom<Domain extends AnyAbstractDomain, StateDomain extends StateAbstractDomain<Domain, StateDomainBottom>>(this: new (value: StateDomainBottom, domain: Domain) => StateDomain, domain: Domain): StateDomain;
get(node: NodeId): Domain | undefined;
has(node: NodeId): boolean;
set(node: NodeId, value: Domain): void;
remove(node: NodeId): void;
top(): this & StateAbstractDomain<Domain, StateDomainTop>;
bottom(): this & StateAbstractDomain<Domain, StateDomainBottom>;
equals(other: this): boolean;
leq(other: this): boolean;
join(other: this): this;
meet(other: this): this;
widen(other: this): this;
narrow(other: this): this;
concretize(limit: number): ReadonlySet<ConcreteState<Domain>> | typeof Top;
abstract(concrete: ReadonlySet<ConcreteState<Domain>> | typeof Top): this;
toJson(): unknown;
toString(): string;
isTop(): this is this & StateAbstractDomain<Domain, StateDomainTop>;
isBottom(): this is this & StateAbstractDomain<Domain, StateDomainBottom>;
isValue(): this is this & StateAbstractDomain<Domain, StateDomainValue<Domain>>;
}