@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
51 lines (50 loc) • 3.07 kB
TypeScript
import { resolveByName, resolveByNameAnyType, resolvesToBuiltInConstant } from './resolve-by-name';
import { resolveIdToValue, resolveIdToSingleString, resolveToConstants } from '../eval/resolve/alias-tracking';
import { resolveIdToArgName, resolveIdToArgStringVector, resolveIdToArgValue, resolveIdToArgValueSymbolName, resolveIdToArgVectorLength } from '../../abstract-interpretation/data-frame/resolve-args';
/**
* The helper object for resolution: from a name to the definitions it may refer to, and from a node to the
* value(s) it may hold. Reachable as {@link Dataflow.resolve} as well.
*
* Take the narrowest entry point that answers your question, they differ a lot in cost:
*
* - {@link Resolve.byName} walks the environment layers once and answers repeat questions from the layer's own
* lookup cache. Use it whenever the {@link ReferenceType} does not matter.
* - {@link Resolve.byNameAndType} additionally filters and merges the definitions of every layer it passes.
* Given the unknown reference type it only forwards to {@link Resolve.byName}, so ask that one directly instead.
* - {@link Resolve.toValue} and the {@link Resolve.argument} family run the evaluator on top of a resolution.
* @example
* ```ts
* Resolve.byName('x', environment); // every definition `x` may refer to
* Resolve.toValue(id, { graph, ctx }); // the value(s) the node may hold
* Resolve.argument.value(call, 'file', ...); // the value of a named argument
* ```
*/
export declare const Resolve: {
readonly name: "Resolve";
/** Every definition the identifier may refer to, whatever its type. */
readonly byName: typeof resolveByNameAnyType;
/** The definitions the identifier may refer to that fit the wanted {@link ReferenceType}. */
readonly byNameAndType: typeof resolveByName;
/** Whether the name always, never, or maybe refers to a built-in constant of the given value. */
readonly toBuiltIn: typeof resolvesToBuiltInConstant;
/** The constant values the name resolves to. */
readonly toConstants: typeof resolveToConstants;
/** The value(s) the node may hold, tracking aliases as the configuration allows. */
readonly toValue: typeof resolveIdToValue;
/** The single string the node resolves to, or `undefined` if it is not exactly one. */
readonly toSingleString: typeof resolveIdToSingleString;
/** The same, for the arguments of a call. */
readonly argument: {
readonly name: "argument";
/** The argument's name. */
readonly toName: typeof resolveIdToArgName;
/** The argument's value. */
readonly value: typeof resolveIdToArgValue;
/** The argument's value as a vector of strings. */
readonly stringVector: typeof resolveIdToArgStringVector;
/** The argument's value as the name of the symbol it holds. */
readonly symbolName: typeof resolveIdToArgValueSymbolName;
/** The length of the vector the argument holds. */
readonly vectorLength: typeof resolveIdToArgVectorLength;
};
};