diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-09-17 04:32:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 04:32:47 +0300 |
commit | e1606d6889fab73b1854b7ad98f0684e65b0584f (patch) | |
tree | 21b72a392c5cf5893cd9c41ba5d73a0f447cb6dd /src/ILCompiler.Compiler | |
parent | abaef6c3d078f7c825efcbfbfcb014e8c0a2b6cc (diff) | |
parent | 472827315047b23339f73b2284e01a6bc56e1800 (diff) |
Merge pull request #4543 from dotnet/nmirror
Merge nmirror to master
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/ILStreamReader.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/ILStreamReader.cs b/src/ILCompiler.Compiler/src/Compiler/ILStreamReader.cs index 9d30c702c..e27edb3b2 100644 --- a/src/ILCompiler.Compiler/src/Compiler/ILStreamReader.cs +++ b/src/ILCompiler.Compiler/src/Compiler/ILStreamReader.cs @@ -175,14 +175,19 @@ namespace Internal.Compiler public bool TryReadLdtokenAsTypeSystemEntity(out TypeSystemEntity entity) { int token; - if (!TryReadLdtoken(out token)) + bool tokenResolved; + try { + tokenResolved = TryReadLdtoken(out token); + entity = tokenResolved ?(TypeSystemEntity)_methodIL.GetObject(token) : null; + } + catch (TypeSystemException.TypeLoadException) + { + tokenResolved = false; entity = null; - return false; } - entity = (TypeSystemEntity)_methodIL.GetObject(token); - return true; + return tokenResolved; } public TypeSystemEntity ReadLdtokenAsTypeSystemEntity() |