ArgBindings.Matching matchingArgBindings = (ArgBindings.Matching)argBindings;
for (int i = 0; i < matchingArgBindings.getNFieldPatterns(); i++) {
FieldPattern fieldPattern = matchingArgBindings.getNthFieldPattern(i);
Pattern pattern = fieldPattern.getPattern();
if (pattern == null) {
// punning.
// Textual field names become Vars of the same name.
// Ordinal field names become wildcards ("_").
FieldName fieldName = fieldPattern.getFieldName().getName();
if (fieldName instanceof FieldName.Textual) {
pattern = Pattern.Var.make(fieldName.getCalSourceForm());
}
}
if (pattern instanceof Pattern.Var) {
Pattern.Var patternVar = (Pattern.Var)pattern;
addRegularBinding(patternVar.getName(), patternVar);
}
}
} else if (argBindings instanceof ArgBindings.Positional) {
ArgBindings.Positional positionalArgBindings = (ArgBindings.Positional)argBindings;
for (int i = 0; i < positionalArgBindings.getNPatterns(); i++) {
Pattern pattern = positionalArgBindings.getNthPattern(i);
if (pattern instanceof Pattern.Var) {
Pattern.Var patternVar = (Pattern.Var)pattern;
addRegularBinding(patternVar.getName(), patternVar);
}
}