@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
16 lines (15 loc) • 1.24 kB
TypeScript
import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
/** what one declared parameter was given: nothing, one argument, or -- for `...` -- every argument it collected */
export type MatchedArgument = RNodeWithParent | readonly RNodeWithParent[] | undefined;
/**
* The arguments of a call, one slot per declared parameter, matched the way R does: a named argument goes to
* the parameter it names, the rest fill the remaining slots left to right, and a `...` parameter collects
* everything that is left over (positional arguments from its position on, and named ones matching no other
* parameter). Parameters in `ignored` may be supplied but get no slot, for the ones that change nothing about
* what the call yields.
*
* `undefined` when the call cannot be the one `params` describes: an argument that names an unknown parameter
* with no `...` to absorb it, one parameter given twice, or more arguments than there are slots. The value
* solver relies on that, since a call it cannot match is one whose result it must not guess at.
*/
export declare function matchCallArguments(node: RNodeWithParent, params: readonly string[], ignored?: readonly string[]): MatchedArgument[] | undefined;