for (int i = 0, numInputs = getNInputs(); i < numInputs; i++) {
PartInput inputPart = getInputPart(i);
String nameFromEntity = i < numNamedArgs ? gemEntity.getNamedArgument(i) : null;
String displayName = i < argMetadata.length ? argMetadata[i].getDisplayName() : null;
FieldName caldocName = (caldoc != null && i < caldoc.getNArgBlocks()) ? caldoc.getNthArgBlock(i).getArgName() : null;
String originalName;
if (displayName != null) {
originalName = displayName;
} else if (caldocName != null && caldocName instanceof FieldName.Textual) {
// if the CALDoc name is present, we will use it instead of the name from the entity
// since the CALDoc name is specified by the user, where the name from the entity
// may have come from an automatically extracted parameter name for a foreign function
originalName = caldocName.getCalSourceForm();
} else if (nameFromEntity != null) {
originalName = nameFromEntity;
} else {
originalName = null;
}