protected virtual void DefineIterTypeParameters(IterDefinition iter)
{
iter.TypeParameters =
(TypedNodeList) currentClass.TypeParameters.Clone();
if (iter.TypeParameters.Length > 0) {
string[] typeParamNames =
new string[iter.TypeParameters.Length];
int i = 0;
foreach (ParameterDeclaration pd in iter.TypeParameters) {
typeParamNames[i++] = pd.Name;
}
GenericTypeParameterBuilder[] typeParameters =
iter.TypeBuilder.DefineGenericParameters(typeParamNames);
i = 0;
foreach (ParameterDeclaration pd in iter.TypeParameters) {
GenericTypeParameterBuilder pb = typeParameters[i++];
if (pd.ConstrainingType.NodeType.IsAbstract) {
Type[] ifaces = new Type[] {
pd.ConstrainingType.RawType
};
pb.SetInterfaceConstraints(ifaces);
}
else {
Type baseType = pd.ConstrainingType.RawType;
if (baseType != typeof(object))
pb.SetBaseTypeConstraint(baseType);
}
pd.NodeType =
new TypeParameterData(typeManager, pb,
pd.ConstrainingType.NodeType);
typeManager.AddType(pd.NodeType);
pd.NodeType.Parents = new ArrayList();
pd.NodeType.Parents.Add(pd.ConstrainingType.NodeType);
}
}
}