|
13 | 13 | namespace Microsoft.NET.WebAssembly.Webcil;
|
14 | 14 |
|
15 | 15 |
|
16 |
| -public sealed class WebcilReader : IDisposable |
| 16 | +public sealed partial class WebcilReader : IDisposable |
17 | 17 | {
|
18 | 18 | // WISH:
|
19 | 19 | // This should be implemented in terms of System.Reflection.Internal.MemoryBlockProvider like the PEReader,
|
@@ -219,37 +219,11 @@ private static CodeViewDebugDirectoryData DecodeCodeViewDebugDirectoryData(BlobR
|
219 | 219 | return MakeCodeViewDebugDirectoryData(guid, age, path);
|
220 | 220 | }
|
221 | 221 |
|
222 |
| - private static string? ReadUtf8NullTerminated(BlobReader reader) |
223 |
| - { |
224 |
| - var mi = typeof(BlobReader).GetMethod("ReadUtf8NullTerminated", BindingFlags.NonPublic | BindingFlags.Instance); |
225 |
| - if (mi == null) |
226 |
| - { |
227 |
| - throw new InvalidOperationException("Could not find BlobReader.ReadUtf8NullTerminated"); |
228 |
| - } |
229 |
| - return (string?)mi.Invoke(reader, null); |
230 |
| - } |
| 222 | + private static string? ReadUtf8NullTerminated(BlobReader reader) => Reflection.ReadUtf8NullTerminated(reader); |
231 | 223 |
|
232 |
| - private static CodeViewDebugDirectoryData MakeCodeViewDebugDirectoryData(Guid guid, int age, string path) |
233 |
| - { |
234 |
| - var types = new Type[] { typeof(Guid), typeof(int), typeof(string) }; |
235 |
| - var mi = typeof(CodeViewDebugDirectoryData).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, types, null); |
236 |
| - if (mi == null) |
237 |
| - { |
238 |
| - throw new InvalidOperationException("Could not find CodeViewDebugDirectoryData constructor"); |
239 |
| - } |
240 |
| - return (CodeViewDebugDirectoryData)mi.Invoke(new object[] { guid, age, path }); |
241 |
| - } |
| 224 | + private static CodeViewDebugDirectoryData MakeCodeViewDebugDirectoryData(Guid guid, int age, string path) => Reflection.MakeCodeViewDebugDirectoryData(guid, age, path); |
242 | 225 |
|
243 |
| - private static PdbChecksumDebugDirectoryData MakePdbChecksumDebugDirectoryData(string algorithmName, ImmutableArray<byte> checksum) |
244 |
| - { |
245 |
| - var types = new Type[] { typeof(string), typeof(ImmutableArray<byte>) }; |
246 |
| - var mi = typeof(PdbChecksumDebugDirectoryData).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, types, null); |
247 |
| - if (mi == null) |
248 |
| - { |
249 |
| - throw new InvalidOperationException("Could not find PdbChecksumDebugDirectoryData constructor"); |
250 |
| - } |
251 |
| - return (PdbChecksumDebugDirectoryData)mi.Invoke(new object[] { algorithmName, checksum }); |
252 |
| - } |
| 226 | + private static PdbChecksumDebugDirectoryData MakePdbChecksumDebugDirectoryData(string algorithmName, ImmutableArray<byte> checksum) => Reflection.MakePdbChecksumDebugDirectoryData(algorithmName, checksum); |
253 | 227 |
|
254 | 228 | public MetadataReaderProvider ReadEmbeddedPortablePdbDebugDirectoryData(DebugDirectoryEntry entry)
|
255 | 229 | {
|
|
0 commit comments