throw new IllegalOperationException(
"Facade cannot be viewed as with keyword parameters.", getType());
}
protected void bindKeywordArgs(Map<String, IValue> keyArgValues) {
Environment env = ctx.getCurrentEnvt();
if (functionType.hasKeywordParameters()) {
for (String kwparam : functionType.getKeywordParameterTypes().getFieldNames()){
Type kwType = functionType.getKeywordParameterType(kwparam);
if (keyArgValues.containsKey(kwparam)){
IValue r = keyArgValues.get(kwparam);
if(!r.getType().isSubtypeOf(kwType)) {
throw new UnexpectedKeywordArgumentType(kwparam, kwType, r.getType(), ctx.getCurrentAST());
}
env.declareVariable(kwType, kwparam);
env.storeVariable(kwparam, ResultFactory.makeResult(kwType, r, ctx));
}
else {
env.declareVariable(kwType, kwparam);
Expression def = getKeywordParameterDefaults().get(kwparam);
Result<IValue> kwResult = def.interpret(eval);
env.storeVariable(kwparam, kwResult);
}
}
}
// TODO: what if the caller provides more arguments then are declared? They are
// silently lost here.