//this is the array of types cached for each argument. If there is no cached type, we just use the argument type.
TypeExpr[] cachedTypes = new TypeExpr[numArgs];
for (int i = 0; i < numArgs; ++i) {
// What we do next depends on whether we use cached sink values
Gem.PartInput inputPart = argParts.get(i);
ValueNode cachedVN = gemCutter.getTableTop().getCachedValue(inputPart);
if (cachedVN != null) {
cachedTypes[i] = cachedVN.getTypeExpr();
}
}
try {
ModuleTypeInfo contextModuleTypeInfo = gemCutter.getPerspective().getWorkingModuleTypeInfo();
specializedInputTypes = TypeExpr.patternMatchPieces(cachedTypes, inputTypes, contextModuleTypeInfo);
} catch (TypeException te) {
throw new IllegalStateException("Error reusing cached args.");
}
} else {
specializedInputTypes = TypeExpr.copyTypeExprs(inputTypes);
}
ValueEditorManager valueEditorManager = gemCutter.getValueEditorManager();
ValueEditorDirector valueEditorDirector = valueEditorManager.getValueEditorDirector();
Map<PartInput, ValueEditor> inputToEditorMap = new LinkedHashMap<PartInput, ValueEditor>();
// Step through args, create a new value input panel for each, with the correct value type
for (int i = 0; i < numArgs; i++) {
// Get the gem and input
final Gem.PartInput inputPart = argParts.get(i);
final Gem inputGem = inputPart.getGem();
int argumentNumber = inputPart.getInputNum();
QualifiedName scName = null;
if (inputGem instanceof FunctionalAgentGem) {
scName = ((FunctionalAgentGem) inputGem).getName();
}
// What we do next depends on whether we use cached sink values
ValueNode cachedVN;
final ValueEditor editor;
if (canUseCachedArgs && (cachedVN = gemCutter.getTableTop().getCachedValue(inputPart)) != null) {
// use cached sink value to generate the VEP
// get a copy of the cached VN but with the new type expr
ValueNode newVN = cachedVN.copyValueNode();
// instantiate the VEP with the new VN (which has the old cached value)
editor = valueEditorDirector.getRootValueEditor(valueEditorHierarchyManager,
newVN,
scName,