@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
74 lines (73 loc) • 3.55 kB
TypeScript
import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
import type { IEnvironment, REnvironmentInformation } from '../../dataflow/environments/environment';
import type { DeepReadonly } from 'ts-essentials';
import type { IdentifierDefinition } from '../../dataflow/environments/identifier';
import { Identifier } from '../../dataflow/environments/identifier';
import type { BuiltInIdentifierDefinition } from '../../dataflow/environments/built-in';
import type { Fingerprint } from '../../slicing/static/fingerprint';
/**
* Read-only interface to the {@link FlowrAnalyzerEnvironmentContext}.
*/
export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
/**
* Get the built-in environment used during analysis.
*/
get builtInEnvironment(): DeepReadonly<IEnvironment>;
/**
* Every built-in definition flowR carries for `name`, matched by its plain name.
*/
builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
/**
* The built-in function flowR defines for `name`, respecting its namespace: `dplyr::filter` picks
* flowR's `dplyr` definition rather than whatever else is registered under `filter`.
*/
builtInFunctionOf(name: Identifier): BuiltInIdentifierDefinition | undefined;
/**
* Whether flowR carries definitions of its own for package `pkg`, i.e. whether it knows what attaching
* that package brings even when no signature database resolves it. Built once and kept, as the built-in
* environment does not change during an analysis.
*/
knowsPackage(pkg: string): boolean;
/**
* Get the empty built-in environment used during analysis.
* The empty built-in environment only contains primitive definitions.
*/
get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
/**
* Create a new {@link REnvironmentInformation|environment} with the configured built-in environment as base.
*/
makeCleanEnv(): REnvironmentInformation;
/**
* Get the fingerprint of the clean environment with the configured built-in environment as base.
*/
getCleanEnvFingerprint(): Fingerprint;
/**
* Create a new {@link REnvironmentInformation|environment} with an empty built-in environment as base.
*/
makeCleanEnvWithEmptyBuiltIns(): REnvironmentInformation;
/**
* A completely empty {@link REnvironmentInformation|environment}.
*/
makeEmptyEnv(): REnvironmentInformation;
}
/**
* Provides the built-in environment, created from the {@link FlowrAnalyzerContext} configuration.
*/
export declare class FlowrAnalyzerEnvironmentContext implements ReadOnlyFlowrAnalyzerEnvironmentContext {
readonly name = "flowr-analyzer-environment-context";
private readonly builtInEnv;
private readonly emptyBuiltInEnv;
private builtInEnvFingerprint;
/** the packages {@link knowsPackage} answers for, collected from the built-in environment on first use */
private knownPackages;
constructor(ctx: FlowrAnalyzerContext);
get builtInEnvironment(): DeepReadonly<IEnvironment>;
get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
knowsPackage(pkg: string): boolean;
builtInFunctionOf(name: Identifier): BuiltInIdentifierDefinition | undefined;
makeCleanEnv(): REnvironmentInformation;
getCleanEnvFingerprint(): Fingerprint;
makeCleanEnvWithEmptyBuiltIns(): REnvironmentInformation;
makeEmptyEnv(): REnvironmentInformation;
}