- Implemented __ContainsMissingType for function pointer types.

- Changed __ContainsMissingType to take custom modifiers into account.
This commit is contained in:
jfrijters 2012-12-24 10:49:51 +00:00
Родитель fdcf287e2e
Коммит ab288e82b5
5 изменённых файлов: 60 добавлений и 36 удалений

Просмотреть файл

@ -200,6 +200,11 @@ namespace IKVM.Reflection
return sb.ToString();
}
public bool ContainsMissingType
{
get { return Type.ContainsMissingType(types); }
}
private Type[] GetRequiredOrOptional(bool required)
{
if (types == null)

Просмотреть файл

@ -441,6 +441,21 @@ namespace IKVM.Reflection
return new PackedCustomModifiers(expanded);
}
internal bool ContainsMissingType
{
get
{
for (int i = 0; i < customModifiers.Length; i++)
{
if (customModifiers[i].ContainsMissingType)
{
return true;
}
}
return false;
}
}
// this method make a copy of the incoming arrays (where necessary) and returns a normalized modifiers array
internal static PackedCustomModifiers CreateFromExternal(Type[] returnOptional, Type[] returnRequired, Type[][] parameterOptional, Type[][] parameterRequired, int parameterCount)
{

Просмотреть файл

@ -90,17 +90,7 @@ namespace IKVM.Reflection.Reader
protected sealed override bool ContainsMissingTypeImpl
{
get
{
foreach (Type type in GetGenericParameterConstraints())
{
if (type.__ContainsMissingType)
{
return true;
}
}
return false;
}
get { return ContainsMissingType(GetGenericParameterConstraints()); }
}
}

Просмотреть файл

@ -111,6 +111,17 @@ namespace IKVM.Reflection
return customModifiers.GetParameterCustomModifiers(index);
}
public bool ContainsMissingType
{
get
{
return returnType.__ContainsMissingType
|| Type.ContainsMissingType(parameterTypes)
|| Type.ContainsMissingType(optionalParameterTypes)
|| customModifiers.ContainsMissingType;
}
}
internal int ParameterCount
{
get { return parameterTypes.Length + optionalParameterTypes.Length; }

Просмотреть файл

@ -1364,23 +1364,30 @@ namespace IKVM.Reflection
}
}
protected virtual bool ContainsMissingTypeImpl
internal static bool ContainsMissingType(Type[] types)
{
get
if (types == null)
{
if (this.__IsMissing)
{
return true;
return false;
}
foreach (Type arg in this.GetGenericArguments())
foreach (Type type in types)
{
if (arg.__ContainsMissingType)
if (type.__ContainsMissingType)
{
return true;
}
}
return false;
}
protected virtual bool ContainsMissingTypeImpl
{
get
{
return __IsMissing
|| ContainsMissingType(GetGenericArguments())
|| __GetCustomModifiers().ContainsMissingType;
}
}
public Type MakeArrayType()
@ -2167,7 +2174,8 @@ namespace IKVM.Reflection
{
type = type.GetElementType();
}
return type.__ContainsMissingType;
return type.__ContainsMissingType
|| mods.ContainsMissingType;
}
}
@ -2922,17 +2930,7 @@ namespace IKVM.Reflection
protected override bool ContainsMissingTypeImpl
{
get
{
foreach (Type type in args)
{
if (type.__ContainsMissingType)
{
return true;
}
}
return this.type.__IsMissing;
}
get { return type.__ContainsMissingType || ContainsMissingType(args); }
}
public override StructLayoutAttribute StructLayoutAttribute
@ -3054,6 +3052,11 @@ namespace IKVM.Reflection
return "<FunctionPtr>";
}
protected override bool ContainsMissingTypeImpl
{
get { return sig.ContainsMissingType; }
}
internal override bool IsBaked
{
get { return true; }
@ -3103,7 +3106,7 @@ namespace IKVM.Reflection
public override bool __IsMissing
{
get { throw new InvalidOperationException(); }
get { return false; }
}
}
}