@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
48 lines (47 loc) • 2.52 kB
TypeScript
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { AnyAbstractDomain } from './abstract-domain';
import { Top } from './lattice';
import type { ConcreteMap } from './mapped-abstract-domain';
import { MappedAbstractDomain } from './mapped-abstract-domain';
/**
* A state abstract domain as mapping of AST node IDs of a program to abstract values of an abstract domain.
* The Bottom element is defined as empty mapping and the Top element is defined as mapping every existing mapped AST node ID to Top.
* @template Domain - Type of the 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> extends MappedAbstractDomain<NodeId, Domain> {
private _isBottom;
constructor(value: ReadonlyMap<NodeId, Domain>, bottom?: boolean);
create(value: ReadonlyMap<NodeId, Domain>, bottom?: boolean): this;
static top<Domain extends AnyAbstractDomain>(): StateAbstractDomain<Domain>;
get(key: NodeId, ignoreBottom?: boolean): Domain | undefined;
protected set(key: NodeId, value: Domain): void;
bottom(): this;
top(): this;
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<ConcreteMap<NodeId, Domain>> | typeof Top;
abstract(concrete: typeof Top | ReadonlySet<ConcreteMap<NodeId, Domain>>): this;
toJson(): unknown;
toString(): string;
isTop(): this is this;
isBottom(): this is this;
isValue(): this is this;
}
/**
* A mutable version of the {@link StateAbstractDomain} with {@link MutableStateAbstractDomain#set|`set`} and {@link MutableStateAbstractDomain#remove|`remove`}.
*/
export declare class MutableStateAbstractDomain<Domain extends AnyAbstractDomain> extends StateAbstractDomain<Domain> {
create(value: ReadonlyMap<NodeId, Domain>): this;
set(key: NodeId, value: Domain): void;
remove(key: NodeId): void;
}
/**
* The type of the value abstract domain of a state abstract domain (i.e. the abstract domain a state abstract domain maps to).
* @template StateDomain - The state abstract domain to get the value abstract domain type for
*/
export type ValueAbstractDomain<StateDomain extends StateAbstractDomain<AnyAbstractDomain>> = StateDomain extends StateAbstractDomain<infer Domain> ? Domain : never;