void ImportTypeParameterTypeConstraints (TypeParameterSpec spec, MetaType type) { var constraints = type.GetGenericParameterConstraints (); List<TypeSpec> tparams = null; foreach (var ct in constraints) { if (ct.IsGenericParameter) { if (tparams == null) tparams = new List<TypeSpec> (); tparams.Add (CreateType (ct)); continue; } var constraint_type = CreateType (ct); if (constraint_type.IsClass) { spec.BaseType = constraint_type; continue; } spec.AddInterface (constraint_type); } if (spec.BaseType == null) spec.BaseType = module.Compiler.BuiltinTypes.Object; if (tparams != null) spec.TypeArguments = tparams.ToArray (); }