int nArguments = appChain.length - 1;
Expression.Var var = appChain[0].asVar();
// Check that the full number of arguments are supplied.
ForeignFunctionInfo foreignFunctionInfo = var.getForeignFunctionInfo();
PrimOps.PrimOpInfo info = null;
info = PrimOps.fetchInfo (var.getName());
int nExpectedArguments;
if (info == null && foreignFunctionInfo == null) {
//not a built-in primitive or a foreign function call
return null;
}
if (info != null) {
nExpectedArguments = info.getArity ();
} else
if (foreignFunctionInfo != null) {
try {
nExpectedArguments = foreignFunctionInfo.getNArguments();
} catch (UnableToResolveForeignEntityException ex) {
throw new CodeGenerationException("Failed to resolve foreign method, field, or constructor.", ex);
}
} else {
//not a built-in primitive or a foreign function call