зеркало из https://github.com/mono/ikvm-fork.git
Changed __ReadTypeName() to __TryReadTypeName() because it should fail when the type is a nested type (because the name of a nested type cannot be expressed by namespace + name).
This commit is contained in:
Родитель
cfc3fd4552
Коммит
87e866af58
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2009-2010 Jeroen Frijters
|
||||
Copyright (C) 2009-2011 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -381,7 +381,7 @@ namespace IKVM.Reflection
|
|||
return null;
|
||||
}
|
||||
|
||||
public void __ReadTypeName(out string ns, out string name)
|
||||
public bool __TryReadTypeName(out string ns, out string name)
|
||||
{
|
||||
if (lazyConstructor == null)
|
||||
{
|
||||
|
@ -396,16 +396,31 @@ namespace IKVM.Reflection
|
|||
if ((typeToken >> 24) == TypeRefTable.Index)
|
||||
{
|
||||
int typeIndex = (typeToken & 0xFFFFFF) - 1;
|
||||
if ((mod.TypeRef.records[typeIndex].ResolutionScope >> 24) == TypeRefTable.Index)
|
||||
{
|
||||
// nested types can't be represented using only a namespace and name,
|
||||
// so we fail
|
||||
ns = null;
|
||||
name = null;
|
||||
return false;
|
||||
}
|
||||
int typeNameSpace = mod.TypeRef.records[typeIndex].TypeNameSpace;
|
||||
ns = typeNameSpace == 0 ? null : mod.GetString(typeNameSpace);
|
||||
name = mod.GetString(mod.TypeRef.records[typeIndex].TypeName);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Constructor.DeclaringType.IsNested)
|
||||
{
|
||||
ns = null;
|
||||
name = null;
|
||||
return false;
|
||||
}
|
||||
ns = Constructor.DeclaringType.Namespace;
|
||||
name = Constructor.DeclaringType.Name;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ConstructorInfo Constructor
|
||||
|
|
Загрузка…
Ссылка в новой задаче