}
}
if (type.hasKeywordParameters()) {
// this fills in the defaults for pattern matching against them:
ConstructorFunction func = ctx.getCurrentEnvt().getConstructorFunction(type);
Map<String, IValue> kwArgs = func.computeKeywordArgs(subjectChildren, subject.getValue().asWithKeywordParameters().getParameters());
for (String kwLabel : type.getKeywordParameterTypes().getFieldNames()) {
IValue subjectParam = kwArgs.get(kwLabel);
if (keywordParameters.containsKey(kwLabel)) {
IMatchingResult matcher = keywordParameters.get(kwLabel);
matcher.initMatch(ResultFactory.makeResult(type.getKeywordParameterType(kwLabel), subjectParam, ctx));
if (!matcher.hasNext()) {
// the matcher can never work, so we can skip initializing the rest
hasNext = false;
break;
}
}
// note if there is no matcher for the current parameter, still we have initialized it because the next
// keyword parameter that who do match on may depend on its dynamic value.
}
}
else if (this.subject.mayHaveKeywordParameters()) {
Map<String, IValue> kwArgs;
// the matching side has no declared keyword parameters (an untyped node), so we do not have default values to take care of
if (this.subject.getType().isAbstractData()) {
ConstructorFunction func = ctx.getCurrentEnvt().getConstructorFunction(((IConstructor) this.subject).getConstructorType());
if (func != null) {
kwArgs = func.computeKeywordArgs(subjectChildren, subject.getValue().asWithKeywordParameters().getParameters());
}
else {
// the definition of the constructor could not be found, so we don't have defaults
kwArgs = this.subject.asWithKeywordParameters().getParameters();
}