public static IType MapTypeInMethodContext(IType type, Ast.Method method, out GeneratorTypeReplacer mapper) { if (type.GenericInfo != null && type.ConstructedInfo == null) { var td = method.GetAncestor <Ast.TypeDefinition>(); var allGenParams = td.GenericParameters.Concat(method.GenericParameters) .Select(gp => (IGenericParameter)gp.Entity).ToArray(); mapper = new GeneratorTypeReplacer(); foreach (var genParam in type.GenericInfo.GenericParameters) { mapper.Replace(genParam, allGenParams.First(gp => gp.Name.Equals(genParam.Name))); } return(mapper.MapType(type)); } mapper = null; return(type); }
public static IType MapTypeInMethodContext(IType type, Ast.Method method) { GeneratorTypeReplacer mapper; return(MapTypeInMethodContext(type, method, out mapper)); }