Skip to content

Commit e0a5de8

Browse files
authored
Fix method lookup generator (#116)
***UPDATE_DEPENDENTS***
1 parent 8780196 commit e0a5de8

File tree

1 file changed

+25
-39
lines changed

1 file changed

+25
-39
lines changed

MetadataProcessor.Core/nanoSkeletonGenerator.cs

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -355,59 +355,45 @@ private void GenerateAssemblyLookup()
355355
{
356356
if (c.IncludeInStub())
357357
{
358-
// don't include if it's on the exclude list
359-
if (!c.IsToExclude())
358+
var className = NativeMethodsCrc.GetClassName(c);
359+
360+
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
360361
{
361-
var className = NativeMethodsCrc.GetClassName(c);
362+
var rva = _tablesContext.ByteCodeTable.GetMethodRva(m);
362363

363-
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
364+
// check method inclusion
365+
// method is not a native implementation (RVA 0xFFFF) and is not abstract
366+
if ((rva == 0xFFFF &&
367+
!m.IsAbstract))
364368
{
365-
var rva = _tablesContext.ByteCodeTable.GetMethodRva(m);
366-
367-
// check method inclusion
368-
// method is not a native implementation (RVA 0xFFFF) and is not abstract
369-
if ((rva == 0xFFFF &&
370-
!m.IsAbstract))
369+
assemblyLookup.LookupTable.Add(new MethodStub()
371370
{
372-
assemblyLookup.LookupTable.Add(new MethodStub()
373-
{
374-
Declaration = $"Library_{_safeProjectName}_{className}::{NativeMethodsCrc.GetMethodName(m)}"
375-
});
376-
}
377-
else
371+
Declaration = $"Library_{_safeProjectName}_{className}::{NativeMethodsCrc.GetMethodName(m)}"
372+
});
373+
}
374+
else
375+
{
376+
// method won't be included, still
377+
// need to add a NULL entry for it
378+
assemblyLookup.LookupTable.Add(new MethodStub()
378379
{
379-
// method won't be included, still
380-
// need to add a NULL entry for it
381-
// unless it's on the exclude list
382-
383-
if (!c.IsToExclude())
384-
{
385-
assemblyLookup.LookupTable.Add(new MethodStub()
386-
{
387-
Declaration = "NULL"
388-
//Declaration = $"**Library_{_safeProjectName}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
389-
});
390-
}
391-
}
380+
Declaration = "NULL"
381+
//Declaration = $"**Library_{_safeProjectName}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
382+
});
392383
}
393384
}
394385
}
395386
else
396387
{
397388
// type won't be included, still
398389
// need to add a NULL entry for each method
399-
// unless it's on the exclude list
400-
401-
if (!c.IsToExclude())
390+
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
402391
{
403-
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
392+
assemblyLookup.LookupTable.Add(new MethodStub()
404393
{
405-
assemblyLookup.LookupTable.Add(new MethodStub()
406-
{
407-
Declaration = "NULL"
408-
//Declaration = $"**Library_{_safeProjectName}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
409-
});
410-
}
394+
Declaration = "NULL"
395+
//Declaration = $"**Library_{_safeProjectName}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
396+
});
411397
}
412398
}
413399
}

0 commit comments

Comments
 (0)