every named argument that exactly matches a formal takes it,
every remaining named argument that is a unique prefix of a still-free formal takes it (pmatch),
judged against the formals step 1 left free, so a formal already taken by name no longer makes a prefix
ambiguous (f(x = 1, xylo = 2) with formals xylo, xb binds x to xb). ... has to be among the names,
as findByPrefixIfUnique reads it as the point after which a formal can only be matched exactly,
the remaining unnamed arguments fill the still-free formals from left to right, stopping at ...
(formals behind ... can only be matched by name), and
everything that is still unmatched goes to ... if the function has one.
Both sides are given by their names alone (undefined for an unnamed argument or an anonymous formal), so this
works for the normalized AST, the dataflow graph, and a plain signature list alike. An empty argument (f(1, ,3))
is an unnamed one: it takes its formal like any other, the caller just has nothing to bind to it.
Parameters
argNames: readonly (string|undefined)[]
paramNames: readonly (string|undefined)[]
Returns readonly (number|undefined)[]
for every argument (by index) the index of the parameter it binds to, undefined if it stays unbound
Bind the arguments of a call to the formal parameters of the called function, following R's argument matching rules (see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching):
pmatch), judged against the formals step 1 left free, so a formal already taken by name no longer makes a prefix ambiguous (f(x = 1, xylo = 2)with formalsxylo, xbbindsxtoxb)....has to be among the names, as findByPrefixIfUnique reads it as the point after which a formal can only be matched exactly,...(formals behind...can only be matched by name), and...if the function has one.Both sides are given by their names alone (
undefinedfor an unnamed argument or an anonymous formal), so this works for the normalized AST, the dataflow graph, and a plain signature list alike. An empty argument (f(1, ,3)) is an unnamed one: it takes its formal like any other, the caller just has nothing to bind to it.