pub(crate) fn check_r_formals(
inputs: &Punctuated<FnArg, Comma>,
formals: &Formals,
reserved: &[(String, String)],
) -> Result<()>Expand description
Check the R formals a signature produces, before any wrapper is generated.
Each parameter becomes its formal (Formals::of: the declared
formal = "..", else normalize_r_arg_string of its name); the &Dots
parameter becomes ..., wherever it sits, and is skipped. A formal must be
an R name (not a reserved word such as if or in, not starting with a
digit; a declared one must pass declared_formal_problem), distinct
from the others (x and _x both become x), and not one of the
reserved names the generated wrapper binds itself (a method’s receiver,
R6’s self and private), each paired with what it is. Any of these would
break the wrapper: a parse error in the wrappers file, or a parameter that
hides the object the method works on.
Every case is a compile error rather than a rename: callers pass arguments by name, so the R formal has to stay the parameter’s own name unless the author declares another. An error points at the declaring literal for a declared formal, else at the parameter. Every problem of the signature is reported, in one combined error.