diff options
author | jfrijters <jfrijters> | 2015-04-07 14:55:51 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2015-04-07 14:55:51 +0300 |
commit | 061a13cc772ef15f4d5528eb84fea4d51d4bda1d (patch) | |
tree | 84109dcdac326789ad754f59abe9a0e87ec9f9fb | |
parent | 9f39c83fb4671ce138c6e8092778b84d012bdf54 (diff) |
Added Module.__TryGetImplMap() public API to get ImplMap by token.
-rw-r--r-- | reflect/MethodInfo.cs | 13 | ||||
-rw-r--r-- | reflect/Module.cs | 15 |
2 files changed, 16 insertions, 12 deletions
diff --git a/reflect/MethodInfo.cs b/reflect/MethodInfo.cs index 40ca321c..6bbdb5f2 100644 --- a/reflect/MethodInfo.cs +++ b/reflect/MethodInfo.cs @@ -109,18 +109,7 @@ namespace IKVM.Reflection public bool __TryGetImplMap(out ImplMapFlags mappingFlags, out string importName, out string importScope) { - Module module = this.Module; - foreach (int i in module.ImplMap.Filter(GetCurrentToken())) - { - mappingFlags = (ImplMapFlags)(ushort)module.ImplMap.records[i].MappingFlags; - importName = module.GetString(module.ImplMap.records[i].ImportName); - importScope = module.GetString(module.ModuleRef.records[(module.ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); - return true; - } - mappingFlags = 0; - importName = null; - importScope = null; - return false; + return Module.__TryGetImplMap(GetCurrentToken(), out mappingFlags, out importName, out importScope); } public ConstructorInfo __AsConstructorInfo() diff --git a/reflect/Module.cs b/reflect/Module.cs index 14e3178a..d93dba5f 100644 --- a/reflect/Module.cs +++ b/reflect/Module.cs @@ -568,6 +568,21 @@ namespace IKVM.Reflection return CustomAttributeData.GetCustomAttributesImpl(new List<CustomAttributeData>(), this, token, null); } + public bool __TryGetImplMap(int token, out ImplMapFlags mappingFlags, out string importName, out string importScope) + { + foreach (int i in ImplMap.Filter(token)) + { + mappingFlags = (ImplMapFlags)(ushort)ImplMap.records[i].MappingFlags; + importName = GetString(ImplMap.records[i].ImportName); + importScope = GetString(ModuleRef.records[(ImplMap.records[i].ImportScope & 0xFFFFFF) - 1]); + return true; + } + mappingFlags = 0; + importName = null; + importScope = null; + return false; + } + #if !NO_AUTHENTICODE public virtual System.Security.Cryptography.X509Certificates.X509Certificate GetSignerCertificate() { |