mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix
This commit is contained in:
parent
d40ca81af1
commit
b87004bb8c
@ -3,6 +3,7 @@
|
||||
using System.Diagnostics;
|
||||
using Mono.CecilX;
|
||||
using Mono.CecilX.Cil;
|
||||
using Mono.CecilX.Rocks;
|
||||
|
||||
namespace Mirror.Weaver
|
||||
{
|
||||
@ -119,23 +120,24 @@ bool WeaveModule(ModuleDefinition moduleDefinition)
|
||||
Stopwatch watch = Stopwatch.StartNew();
|
||||
watch.Start();
|
||||
|
||||
foreach (TypeDefinition td in moduleDefinition.Types)
|
||||
// ModuleDefinition.Types only finds top level types.
|
||||
// GetAllTypes recursively finds all nested types as well.
|
||||
// fixes nested types not being weaved, for example:
|
||||
// class Foo { // ModuleDefinition.Types finds this
|
||||
// class Nested { // .Types.NestedTypes finds this
|
||||
// class DeepNested { // only GetAllTypes finds this too
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
foreach (TypeDefinition td in moduleDefinition.GetAllTypes())
|
||||
{
|
||||
// weave base type:
|
||||
Log.Warning($"WEAVER CONSIDERING: {td.FullName}");
|
||||
Log.Warning($"GETALL: {td.FullName}");
|
||||
if (td.IsClass && td.BaseType.CanBeResolved())
|
||||
{
|
||||
modified |= WeaveNetworkBehavior(td);
|
||||
modified |= ServerClientAttributeProcessor.Process(weaverTypes, Log, td, ref WeavingFailed);
|
||||
}
|
||||
|
||||
// TODO weave nested types recursively
|
||||
foreach (TypeDefinition nestedTd in td.NestedTypes)
|
||||
{
|
||||
Log.Warning($" NESTED: {nestedTd.FullName}");
|
||||
modified |= WeaveNetworkBehavior(nestedTd);
|
||||
modified |= ServerClientAttributeProcessor.Process(weaverTypes, Log, nestedTd, ref WeavingFailed);
|
||||
}
|
||||
}
|
||||
|
||||
watch.Stop();
|
||||
|
Loading…
Reference in New Issue
Block a user