UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

33 lines (32 loc) 2.35 kB
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id'; import { type AbstractProduct, PartialProductDomain } from './partial-product-domain'; import { type StateDomainLift, StateAbstractDomain } from './state-abstract-domain'; /** * A reduction function for abstract values of a product domain. */ export type Reduction<Product extends AbstractProduct> = (value: Product) => Product; /** * A multi-value state abstract domain that maps AST node IDs to multiple abstract values from different abstract domains. * @template Product - Type of the abstract product of the multi-value domain combining multiple abstract values * @see {@link NodeId} for the node IDs of the AST nodes */ export declare class MultiValueStateDomain<Product extends AbstractProduct, Value extends StateDomainLift<MultiValueDomain<Product>> = StateDomainLift<MultiValueDomain<Product>>> extends StateAbstractDomain<MultiValueDomain<Product>, Value> { constructor(value: Value, domain: Required<Product>, reductions?: readonly Reduction<Product>[]); create(value: StateDomainLift<MultiValueDomain<Product>>): this; getValue<Key extends keyof Product>(node: NodeId, property: Key): Product[Key] | undefined; hasValue(node: NodeId, property: keyof Product): boolean; setValue<Key extends keyof Product>(node: NodeId, property: Key, value: Product[Key]): void; } /** * A multi-value abstract domain as a (partial) product domain that combines multiple abstract domains. * The Bottom element is defined as mapping every sub abstract domain to Bottom and the Top element is defined as having no sub abstract domain value. * @template Product - Type of the abstract product of the multi-value domain combining multiple abstract values * @see {@link MultiValueStateDomain} for a state abstract domain of a multi-value domain */ export declare class MultiValueDomain<Product extends AbstractProduct> extends PartialProductDomain<Product> { readonly reductions: readonly Reduction<Product>[]; constructor(value: Product, domain: Required<Product>, reductions?: readonly Reduction<Product>[]); create(value: Product): this; static top<Product extends AbstractProduct>(domain: Required<Product>, reductions?: readonly Reduction<Product>[]): MultiValueDomain<Product>; protected reduce(value: Product): Product; }