static GenericParamContext GetGenericParamContext(ITypeOrMethodDef tmOwner) { if (tmOwner is MethodDef md) { return(GenericParamContext.Create(md)); } return(new GenericParamContext(tmOwner as TypeDef)); }
internal CreateGenericParameter(IContext context, GenericParam source, ITypeOrMethodDef targetTypeOrMethod, TypeMapping typeMapping) : base(context) { Source = source; TargetTypeOrMethod = targetTypeOrMethod; TypeMapping = typeMapping; }
static GenericParamContext GetGenericParamContext(ITypeOrMethodDef tmOwner) { var md = tmOwner as MethodDef; if (md != null) { return(GenericParamContext.Create(md)); } return(new GenericParamContext(tmOwner as TypeDef)); }
void CopyGenericParameters(ITypeOrMethodDef source, ITypeOrMethodDef dest) { foreach (var gp in source.GenericParameters) { var target = Context.Fire(new NetfuserEvent.CreateGenericParameter(Context, gp, dest, _tm) { Target = new GenericParamUser(gp.Number, gp.Flags, gp.Name) }).Target; dest.GenericParameters.Add(target); foreach (var c in gp.GenericParamConstraints) { target.GenericParamConstraints.Add(Clone(c)); } } }
/// <summary> /// Constructor /// </summary> /// <param name="isTypeVar"><c>true</c> if it's a <c>Var</c>, <c>false</c> if it's a <c>MVar</c></param> /// <param name="number">Generic param number</param> /// <param name="genericParamProvider">Owner method/type or <c>null</c></param> protected GenericSig(bool isTypeVar, uint number, ITypeOrMethodDef genericParamProvider) { this.isTypeVar = isTypeVar; this.number = number; this.genericParamProvider = genericParamProvider; }
static GenericParamContext GetGenericParamContext(ITypeOrMethodDef tmOwner) { var md = tmOwner as MethodDef; if (md != null) return GenericParamContext.Create(md); return new GenericParamContext(tmOwner as TypeDef); }