@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
52 lines (51 loc) • 2.5 kB
TypeScript
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
import Joi from 'joi';
import type { ParsedQueryLine } from '../../query';
import { executeDoesCallQuery } from './does-call-query-executor';
import { type NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { SlicingCriterion } from '../../../slicing/criterion/parse';
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
import type { FlowrConfig } from '../../../config';
interface CallsIdConstraint {
readonly type: 'calls-id';
/** The id of the function being called. */
readonly id: NodeId;
}
interface CallsWithNameConstraint {
readonly type: 'name';
/** The name of the function being called. */
readonly name: string;
/** Should we match the name exactly, or as a regex? */
readonly nameExact?: boolean;
}
interface CallsConstraints {
readonly type: 'and' | 'or' | 'one-of';
readonly calls: readonly CallsConstraint[];
}
export type CallsConstraint = CallsIdConstraint | CallsWithNameConstraint | CallsConstraints;
/**
* Either checks whether a given function calls another function matching the given constraints,
* or returns all functions that call any function matching the given constraints.
*/
export interface DoesCallQuery extends BaseQueryFormat {
readonly type: 'does-call';
readonly queryId?: string;
readonly call: SlicingCriterion;
readonly calls: CallsConstraint;
}
export interface FindAllCallsResult {
readonly call: NodeId;
}
export interface DoesCallQueryResult extends BaseQueryResult {
/** Results are either false (does not call) or an object with details on the calls made */
readonly results: Record<string, FindAllCallsResult | false>;
}
declare function doesCallQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'does-call'>;
export declare const DoesCallQueryDefinition: {
readonly executor: typeof executeDoesCallQuery;
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
readonly fromLine: typeof doesCallQueryLineParser;
readonly schema: Joi.ObjectSchema<any>;
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
};
export {};