TypeParameter[] initialize_type_params ()
{
if (type_param_list != null)
return type_param_list;
DeclSpace the_parent = Parent;
if (this is GenericMethod)
the_parent = null;
var list = new List<TypeParameter> ();
if (the_parent != null && the_parent.IsGeneric) {
// FIXME: move generics info out of DeclSpace
TypeParameter[] parent_params = the_parent.TypeParameters;
list.AddRange (parent_params);
}
int count = type_params != null ? type_params.Length : 0;
for (int i = 0; i < count; i++) {
TypeParameter param = type_params [i];
list.Add (param);
if (Parent.CurrentTypeParameters != null) {
foreach (TypeParameter tp in Parent.CurrentTypeParameters) {
if (tp.Name != param.Name)
continue;
Report.SymbolRelatedToPreviousError (tp.Location, null);
Report.Warning (693, 3, param.Location,
"Type parameter `{0}' has the same name as the type parameter from outer type `{1}'",
param.Name, Parent.GetSignatureForError ());
}
}
}
type_param_list = new TypeParameter [list.Count];
list.CopyTo (type_param_list, 0);
return type_param_list;
}