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),
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),...(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.