Added new public API Module.__ResolveTypeSpecCustomModifiers() to resolve the (useless) custom modifiers that can be put on TypeSpecs.

This commit is contained in:
jfrijters 2013-01-29 08:10:44 +00:00
Родитель 32ee764929
Коммит cad052fcaf
2 изменённых файлов: 17 добавлений и 2 удалений

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

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2012 Jeroen Frijters Copyright (C) 2009-2013 Jeroen Frijters
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -287,6 +287,11 @@ namespace IKVM.Reflection
throw new NotSupportedException(); throw new NotSupportedException();
} }
public virtual CustomModifiers __ResolveTypeSpecCustomModifiers(int typeSpecToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
{
throw new NotSupportedException();
}
public int MetadataToken public int MetadataToken
{ {
get { return IsResource() ? 0 : 1; } get { return IsResource() ? 0 : 1; }

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

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2012 Jeroen Frijters Copyright (C) 2009-2013 Jeroen Frijters
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -759,6 +759,16 @@ namespace IKVM.Reflection.Reader
} }
} }
public override CustomModifiers __ResolveTypeSpecCustomModifiers(int typeSpecToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
{
int index = (typeSpecToken & 0xFFFFFF) - 1;
if (typeSpecToken >> 24 != TypeSpecTable.Index || index < 0 || index >= TypeSpec.RowCount)
{
throw TokenOutOfRangeException(typeSpecToken);
}
return CustomModifiers.Read(this, ByteReader.FromBlob(blobHeap, TypeSpec.records[index]), new GenericContext(genericTypeArguments, genericMethodArguments));
}
public override string ScopeName public override string ScopeName
{ {
get { return GetString(ModuleTable.records[0].Name); } get { return GetString(ModuleTable.records[0].Name); }