static bool MatchThenParams(VList<LNode> cArgs, VList<LNode> pArgs, LNode paramsCap, ref MMap<Symbol, LNode> captures, ref VList<LNode> attrs)
{
// This helper function of MatchesPattern() is called when pArgs is followed
// by a $(params capture). cArgs is the list of candidate.Args that have not
// yet been matched; pArgs is the list of pattern.Args that have not yet been
// matched, and paramsCap is the $(params capture) node that follows pArgs.
captures = captures ?? new MMap<Symbol, LNode>();
int c = 0, p = 0;
restart:
for (; p < pArgs.Count; p++, c++) {
if (IsParamsCapture(pArgs[p])) {
if (!CaptureGroup(ref c, ref p, cArgs, pArgs, ref captures, ref attrs))
return false;
goto restart;
} else {
if (c >= cArgs.Count)
return false;
if (!MatchesPatternNested(cArgs[c], pArgs[p], ref captures, ref attrs))
return false;
}
}
AddCapture(captures, paramsCap, new Slice_<LNode>(cArgs, c));
return true;
}