internal UserTypeTransformation FindTransformation(Symbol type, UserType ownerUserType)
{
// Find first transformation that matches the specified type
string originalFieldTypeString = type.Name;
var transformation = typeTransformations.FirstOrDefault(t => t.Matches(originalFieldTypeString));
if (transformation == null)
return null;
// Create type converter function for the transformation
Func<string, string> typeConverter = null;
typeConverter = (inputType) =>
{
var tr = typeTransformations.FirstOrDefault(t => t.Matches(inputType));
if (tr != null)
{
return tr.TransformType(inputType, ownerUserType.ClassName, typeConverter);
}
UserType userType;
if (GetUserType(type.Module, inputType, out userType))
{
return userType.NonSpecializedFullClassName;
}
return "Variable";
};
return new UserTypeTransformation(transformation, typeConverter, ownerUserType, type);
}