Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata Provider fixes & enhancements #40

Open
wants to merge 15 commits into
base: metadata-provider
Choose a base branch
from
1 change: 1 addition & 0 deletions Backend/Utils/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace Backend.Utils
{
Expand Down
20 changes: 18 additions & 2 deletions CCIProvider/TypeExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,31 @@ private void ExtractGenericTypeParameters(IGenericDefinition definingType, Cci.I
var index = (ushort)i;
var name = parameterdef.Name.Value;
var typeKind = GetGenericParameterTypeKind(parameterdef);
var parameter = new GenericParameter(GenericParameterKind.Type, index, name, typeKind);
var variance = GenericParameterVariance.NONE;
switch (parameterdef.Variance)
{
case Cci.TypeParameterVariance.Contravariant:
variance = GenericParameterVariance.CONTRAVARIANT;
break;
case Cci.TypeParameterVariance.Covariant:
variance = GenericParameterVariance.COVARIANT;
break;
}

var parameter = new GenericParameter(GenericParameterKind.Type, index, name, typeKind)
{
Variance = variance,
DefaultConstructorConstraint = parameterdef.MustHaveDefaultConstructor
};

ExtractAttributes(parameter.Attributes, parameterdef.Attributes);

parameter.GenericContainer = definingType;
definingType.GenericParameters.Add(parameter);

defGenericContext.TypeParameters.Add(parameter);
}
parameter.Constraints.AddRange(parameterdef.Constraints.Select(cciTypeRef => ExtractType(cciTypeRef)));
}
}

private static IList<Cci.IGenericTypeParameter> GetAllGenericTypeParameters(Cci.ITypeDefinition typedef)
Expand Down
Loading